-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Under module resolution NodeNext declaration file lookup does not use "types" property of package.json #51996
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
Comments
ottokruse
changed the title
With module resolution NodeNext an error is raised for library aws-jwt-verify
Under module resolution NodeNext declaration file lookup does not use "types" property of package.json
Jan 2, 2023
RyanCavanaugh
added
the
Needs Investigation
This issue needs a team member to investigate its status.
label
Jan 4, 2023
weswigham
added
Working as Intended
The behavior described is the intended behavior; this is not a bug
and removed
Needs Investigation
This issue needs a team member to investigate its status.
labels
Jan 5, 2023
|
Makes total sense, thanks for the help. |
tmillican
added a commit
to tmillican/iti
that referenced
this issue
Jan 9, 2023
Required to support `"moduleResolution": "NodeNext"`. See: microsoft/TypeScript#51996
tmillican
added a commit
to tmillican/iti
that referenced
this issue
Jan 10, 2023
Two issues: 1. The `exports` map in `package.json` needs to include the `types` key. See: microsoft/TypeScript#51996 2. Explicit `.js` extension is needed for the `export ... from` statements in `src/index.ts` to satisfy ESM. Point 2 in turn required a minor tweak to the import statement in two of the tests (must import `createContainer from `./src/iti`, not merely `./src`).
tmillican
added a commit
to tmillican/iti
that referenced
this issue
Jan 10, 2023
Two issues: 1. The `exports` map in `package.json` needs to include the `types` key. See: microsoft/TypeScript#51996 2. Explicit `.js` extension is needed for the `export ... from` statements in `src/index.ts` to satisfy ESM. Point 2 in turn required a minor tweak to the import statement in two of the tests (must import `createContainer from `./src/iti`, not merely `./src`).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Under module resolution
NodeNext
declaration files (*.d.ts) need to be right next to the corresponding js files. It does not work to have them elsewhere but point to the right location with the "types" property of package.json.For example, aws-jwt-verify has the following installed directory structure, with both CJS and ESM files (using
exports
to select the right file at runtime), but 1 set of typings at the root:importing
aws-jwt-verify
fails with:Setting module resolution to "node" fixes this.
(Our library does work under NodeJS and ESM, so it works with NodeJS module resolution. I.e. this a typings issue only.)
🔎 Search Terms
moduleresolution nodenext
🕗 Version & Regression Information
moduleResolution NodeNext was introduced in TypeScript 4.7
⏯ Playground Link
I can't reproduce this in the playground (a different error is thrown), but this would be it:
Workbench Repro
💻 Code
Repo with code that reproduces the issue:
https://github.com/ottokruse/nodenext-resolution-issue
🙁 Actual behavior
Module declaration can't be found.
🙂 Expected behavior
Module declaration can be found.
The text was updated successfully, but these errors were encountered: