-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: TypeScript 4.8 unable to discover @preact/signals for auto import #111
Comments
Thanks for reporting this issue. To be honest this sounds more like an issue in TypeScripts language server and not something in the signals library. I tried to reproduce it on my end, but auto importing works fine for me in TS 4.8. I'd recommend reaching out to their issue tracker. A quick search reveals a few issues with project references and auto imports. |
@marvinhagemeister Thanks and I've moved this to the TypeScript Github repo. |
I suspect this is at least in part a TypeScript bug, but the first thing I noticed in my at-a-glance investigation is that the |
While we’re talking about package exports, though, maybe also consider adding “module” as well to help ensure there’s only ever one instance of signals in the end bundle. :) |
@andrewbranch Thanks for taking a look, that's much appreciated! Tried it out various approaches and I'm still unable to reproduce the described issue on my end.
Regardless of the combinations I've tried, IntelliSense was able to find the correct definition file. It didn't break. Only when I removed the When adding the imports and building with tsc's @frehner I'm curious to learn more. Why would adding the |
Yeah! I cite 3 sources in the exports section here https://github.com/frehner/modern-guide-to-packaging-js-library#define-your-exports but the TLDR is that bundlers came to the agreement that they would use the module field in package exports when bundling, regardless of whether a package was imported or required, to help dedupe the package and also help prevent the dual package hazard. |
It turns out it’s working due to a bug in TypeScript, which I think we are unlikely to fix, but we agreed that the Because you have no |
@andrewbranch That sounds perfect 👍 We'll move the |
Description
Not sure if this is the right place to post this TypeScript specific issue but I found out that auto importing @preact/signals fails in VSCode when using latest TypeScript 4.8. Auto importing works just fine when downgrading to TypeScript 4.7.
Affected TypeScript version:
4.8.3
Affected
@preact/signals
version:1.0.3
Steps to reproduce
.ts
or.tsx
file with simple TSConfig file.signals
to trigger VSCode's autocompletion to auto importsignals
from@preact/signals
Expected behavior
Auto imports should work when typing
signals
Actual behavior
Auto imports fails to auto import anything from
@preact/signals
when using TypeScript 4.8.The text was updated successfully, but these errors were encountered: