-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add "types" to package exports for TypeScript NodeNext #101
Conversation
TypeScript 4.7 has support for package exports, however it requires that each package export entry specifies the typings for that export. If omitted, for a project that is using the new `NodeNext` resolution mode, the typings will not be found: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#package-json-exports-imports-and-self-referencing This PR adds a "types" field to the two export conditions, so that they can be imported when using the `NodeNext` setting in TypeScript 4.7.
Thanks for the patch @aomarks - the tests pass so I am going to merge this. |
Published 5.0.4 to NPM https://www.npmjs.com/package/urlpattern-polyfill/v/5.0.4 |
Thanks for the super fast review and publish! Much appreciated. It looks like for some reason the https://unpkg.com/browse/urlpattern-polyfill@5.0.4/dist/index.d.ts |
That is very strange, not sure how that could be @SanderElias ? |
Confirmed, it's compiling nicely for us now. Thanks again! |
- Upgrades almost all dependencies, both dev and prod. - There were only 2 deps I didn't tackle in this PR, because it seems like they'll need a little more work: - parse5 6 -> 7 (cc @43081j, seems like the types API is substantially different now, so I wasn't able to easily do this upgrade). - react 17 -> 18 (cc @justinfagnani @taylor-vann I wasn't sure what the implications/requirements for upgrading to react 18 will be, so I didn't even try). - Consolidated some very common devDeps (e.g. uvu, mocha) into the top-level package.json, for easier future upgrade. - Removes some unnecessary dependencies I found. - Updates a few spots where typings changed. - Removes 350MB (1.6GB -> 1.25GB) and 999 packages (3122 -> 2123), from our install. - FYI these external PRs were also needed to get things fully upgraded: - kenchris/urlpattern-polyfill#101 - google/tachometer#239
TypeScript 4.7 has support for package exports, however it requires that each package export entry specifies the typings for that export. If omitted, for a project that is using the new
NodeNext
resolution mode, the typings will not be found: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#package-json-exports-imports-and-self-referencingThis PR adds a "types" field to the two export conditions, so that they can be imported when using the
NodeNext
setting in TypeScript 4.7.It also adds a
.js
extension toindex.d.ts
's import oftypes
, which is also required when consumers are using the newNodeNext
resolution mode.