You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using ESM / "Node next" module resolution, I'm encountering issues where TS knows how to type createStitches, but fails to get the typings of any of the produced tools.
I believe this is due to using moduleResolution: 'node16' in TypeScript and/or "type": "module" in my app's package.json. Might be related to how that works with other tsconfig options.
If you click through to the definition of createStitches, then follow up to the referenced StitchesConfig defintion, VS Code's Typescript can't follow the module reference.
TS can't follow the import of ./config from @stitches/react/types/index.d.ts. Since it can't reach that file, it can't provide typings for any of my components using styled, etc.
I believe this could be because with ESM rules it expects ./config.js as the module path, since file extensions are now mandatory.
Noticed your code is using extensions for imports, so not that. I believe the actual cause is that the emitted type declaration files don't use extensions, possibly because they were generated from a non ESM build... can the declaration file build be updated to use ESM resolution?
Edit: just realized the dts are handrolled. I'll submit a PR to add extensions to fix this problem!
Bug report
Describe the bug
Using ESM / "Node next" module resolution, I'm encountering issues where TS knows how to type
createStitches
, but fails to get the typings of any of the produced tools.I believe this is due to using
moduleResolution: 'node16'
in TypeScript and/or"type": "module"
in my app'spackage.json
. Might be related to how that works with other tsconfig options.I have a minimal repro which produces the problem locally here: https://github.com/a-type/stitches-esm-repro.
If you click through to the definition of
createStitches
, then follow up to the referencedStitchesConfig
defintion, VS Code's Typescript can't follow the module reference.TS can't follow the import of
./config
from@stitches/react/types/index.d.ts
. Since it can't reach that file, it can't provide typings for any of my components usingstyled
, etc.I believe this could be because with ESM rules it expects
./config.js
as the module path, since file extensions are now mandatory.My tsconfig is roughly:
In my main app it's more complex, but this seems to reproduce the problem.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
pnpm install
src/App.tsx
Button
orstyled
. My editor saysany
.Expected behavior
styled
, etc are typed correctly and produce fully typed components.Screenshots
System information
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: