Open Toeler opened 1 month ago
@Toeler , I'm failing to duplicate this, even in your stackblitz I dont see any error, are you still having the issue ?
Maybe it could be your IDE, have you tried restarting the TS service or even the IDE
In the Stackblitz it isn't failing to compile, but the error is visible when viewing the typescript definition.
I haven't yet figured what in my apps build process is causing it to fail it but it's definitely the same error. I was also able to reproduce the error by building the package from source and checking the definition in my IDE.
My temporary workaround was to add skipLibChecks to my tsconfig but that isn't a permanent fix.
I just notice something in the stactkblitz not sure is the same in your env , the typescript version is old 4.0.2, this depends on angular 17 so typescript must be 5.x could this be the problem in your env?
Ahh, good eye. I just used a pre-built Stackblitz from the @ngrx/signals github and modified it.
But that is a red herring. my project is running ~5.3.3
as is the fresh install of the @ngrx-traits source code that I have.
I think it is to do with how typescript tries to import the implied return type of the two functions. All of the other features that this package exports have explicit return types.
Here is a quick patch which uses some types that I pulled from the generated definition file. This fixes the errors. ngrx-traits-10-46-30-AM.patch
Hey thanks for the patch, yeah that looks like should work, I will test it , but Im still intrigued I can not duplicate in my projects does not happen, Im investigating maybe is tsconfig difference
ok my projects have skipLibCheck : true , I tried generating new angular projects using ng new and its like that by default, which is probably why my projects have it, I think is by default set to true because it speeds up compilation, otherwise is type checking all node_modules, but anyway the library should still work with it on false so Ill test the fix
Forgot to update on this, I tested a fix for this weeks ago, but it causes a bug in intellij j in their new TS engine that makes the intellisense in the angular templates not work, is an intellij bug because the intellij sense outside the template works fine, and in vscode there is no problems at all. What I been doing is every time the do a new intellj release Im checking if it fixes the problem. So for now I think the intellj bug will affect more users because skipLibCheck: is true by default , so Im holding the fix for now
In the @ngrx-traits/signals package, the
with-state-logger
andwith-sync-to-web-storage
files are generating type definitions that fail to compile.This can be seen here: https://stackblitz.com/edit/ngrx-signal-store-starter-7bcgrp?file=node_modules%2F%40ngrx-traits%2Fsignals%2Flib%2Fwith-sync-to-web-storage%2Fwith-sync-to-web-storage.d.ts
I'm not sure why this still is able to run, but if you right click on
withSyncToWebStorage
in the imports and view the definitions, you will se the error. In my personal project I can't even get it to run if I import any functions at all from @ngrx-traits/signals, even if I don't use them.The generated definition file is something like this:
With the error