ngrx / platform

Reactive State for Angular
https://ngrx.io
Other
7.96k stars 1.95k forks source link

[Bug] @ngrx/signals: DeepSignal is not exported #4372

Closed Rafael94 closed 3 weeks ago

Rafael94 commented 1 month ago

Which @ngrx/* package(s) are the source of the bug?

signals

Minimal reproduction of the bug/regression with instructions

I am using signalStore with a nested object and get the following error message from Webstorm and when compiling:

The inferred type of 'MyService' cannot be named without a reference to 'node_modules/@ngrx/signals/src/deep-signal'. This is likely not portable. A type annotation is necessary.

I can run it locally without any problems and everything works fine.

I use it in an angular library and not directly in a angular project.

If I set the declaration in tsconfig.json to false, it works.

If I add the entry export { DeepSignal } from './deep-signal'; in /node_modules/@ngrx/signals/src/index.d.ts, the compilation also works.

Expected behavior

No error message should appear when compiling (ng build).

Probably only export { DeepSignal } from ‘./deep-signal’ has to be added toindex.ts.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

@ngrx/signals: 18.0.0-beta.1 Angular: 18.0.1

Other information

No response

I would be willing to submit a PR to fix this issue

timdeschryver commented 1 month ago

I can run it locally without any problems and everything works fine.

This might be related to WebStorm.

Do you have a working reproduction / have you tried this in VSCode?

Rafael94 commented 1 month ago

I am sure that the error is not due to the IDE.

As soon as I run ng build I get the same error.

I have just quickly created a minimal example. The store is located in projects/library/src/lib

As soon as ng build library is executed, the error is displayed.

https://github.com/Rafael94/signal-store-test

timdeschryver commented 1 month ago

Thanks @Rafael94