-
Notifications
You must be signed in to change notification settings - Fork 240
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
RFC: Adding types information to the Package JSON in the registry #126
Conversation
I can come to today's (or any) upcoming RFC meeting if you'd like me to answer questions 👍 |
Update from the last RFC meeting
I've given this RFC an update based on our discussions yesterday (and from @Haroenv's feedback, and I've pinged the flow team for feedback ) The main focus of the update:
|
Hi folks - I'll come along to the next Open RFC Meeting, I'm not sure what to make of the notes from the last one 👍 |
OK, this RFC is updated based on the meeting today in #153 We're good to add this field to the packment during the package building phase. No-one had strong opinions around the name of the field, so I kept it as |
As commented in the call: it'd be great to have the paths be required to start with |
Agreed! - updated that to be explicit in the RFC ( and linking it to the TS issue on the topic microsoft/TypeScript#38249 ) |
This has a PR: npm/read-package-json#92 |
Looking at this, wouldn't it be better to have something like:
but also support specifying a package where types can be found:
Which would allow for tooling to automatically install the right third-party managed types. |
Yeah, this came up a lot during the discussions and is somewhat covered in the RFC:
However, given there's already a very large corpus of TypeScript code with I opened microsoft/TypeScript#38249 to talk about ways in which that could be described in TypeScript |
This is going out today in |
This is probably not the place to post this. Please let me know if there's a more appropiate place to put this in. index.d.ts is included |
I believe modern builds of npm will automatically add 'types' to your package.json (during deployment) via npm/read-package-json#103 - so you can either update your npm client to have it automatically added, or add the 'types' value yourself |
I shouldn’t have to edit my package.json for that tho; npm should infer it regardless. |
Is that logic impacted by |
I am assuming that the npm search index for the site isn't reaching into the tarball fs and is instead using the packument as the source of truth for the icon (which would be replicating the work in npm/read-package-json#103 in the server ). I could be wrong though. You wouldn't have to update the package json if the deploying npm version included npm/read-package-json#103 because it gets baked into the richer package.json which is uploaded
No idea TBH, but probably not, I think the feature in the npm site was added before esm support was unprefixed in node. |
@orta i have the TS logo displayed on a ton of my packages, but i guess that's because they have DT packages instead of shipping types? |
What / Why
Add an unambiguous notation to the packument package.json whether a dependency includes types inside the tarball.
It would be great to know from the NPM API if a library included type definitions. This would allow the npm website, and other tooling to be able to help people make decisions about which dependencies they would like to use and support for types plays into that.
References
Prior work on the search index used by npm's site: algolia/npm-search#346