-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: add "types" field to package.json #24
Conversation
So that older versions of typescript without support for exports map are able to resolve types correctly.
you may be able to remove |
Removing |
Hi all, I haven't merged this yet because I want to redo the way types are discovered according to https://twitter.com/atcb/status/1634653545407610880 |
hmmm, Is that supported by old versions of typescript too? And is it resolved/found even if an exports map exists that does not export it? while specifying "types" in package.json twice is a bit redundant, it allows for wide compatibility without a need to change anything else. |
That advice seems quite surprising to me. I've also never seen it. If I do a Google search for "index.d.cjs" there's only two results and one is that Tweet
I don't understand why you'd specify |
i meant if you have a top level "types", "typings" is indeed not needed for typescript itself, so can be removed if no other tool needs it. Im not aware of one, but also not familiar with why "typings" exists in the first place so not 100% sure |
Ah, thanks for clarifying. The other way to deal with this if you want to modernize the package would just be to specify |
@andrewbranch does your advice hold for earlier TS versions as well? Or does it only work for more recent ones with support for |
|
Note that It seems safest to me to just replace |
So that older versions of typescript without support for exports map are able to resolve types correctly.
see sveltejs/svelte#8362 for an example where it failed