stitchesjs / stitches

[Not Actively Maintained] CSS-in-JS with near-zero runtime, SSR, multi-variant support, and a best-in-class developer experience.
https://stitches.dev
MIT License
7.73k stars 249 forks source link

add .js extension to .d.ts files (TS NodeNext fix) #1086

Closed a-type closed 1 year ago

a-type commented 1 year ago

fixes type module resolution for NodeNext/ESM in TypeScript

fixes #1084

TypeScript requires .d.ts files to follow ESM module import rules as well, so these files needed extensions added to imported local modules so that types can be resolved when Stitches is used in a project that has moduleResolution: 'NodeNext'.

a-type commented 1 year ago

Well, I thought this would be enough, but using linking to test this locally all my styled native elements are being typed as StyledComponent<string, ... and are still broken. Unsure if that's related to linking (new to pnpm). If I do styled('div' as const it's happy, so it's at least an improvement.

a-type commented 1 year ago

Yeah, there are minor ESM differences like not being able to import directory indexes which could trip up in the future, but hopefully this is good enough for now. Glad I can drop my local npm links now! Thanks for the review.