prettier / prettier-synchronized

Synchronous version of Prettier
MIT License
23 stars 7 forks source link

Rename index.d.cts to index.d.ts so TS will pick it up #14

Closed matwilko closed 10 months ago

matwilko commented 1 year ago

TypeScript always expects type definition files to have the extension .d.ts, regardless of the original file extension. Renaming to index.d.ts allows the TS compiler to pick up the types :smile:

remcohaszing commented 1 year ago

This is not true. If the source file has a .cjs extension, TypeScript expects a .d.cts extension. I tried and this works for all variants of "moduleResolution". The change in this PR tells TypeScript that this package has an ESM-only export and can’t be used with CJS.

The only possible reason I can think of you ran into this issue, is that you use a very old version of TypeScript.

matwilko commented 10 months ago

Yup, totally right, not sure what was happening here - everything seems to work perfectly fine now, but it was definitely reproducible locally at the time on the latest Typescript, wouldn't have filed otherwise :)