-
Notifications
You must be signed in to change notification settings - Fork 2
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
TypeScript cannot find .d.ts when using moduleResolution: NodeNext #5
Comments
@NWilson Thank you for the reporting. I've already almost forgotten the exact reasons but I guess the current complex tricky structrure of Hmm, found. Issue #3 made the change. On your environment, the following plan B or C do work? (not tested on the environments though) Plan B (types duplicated)
Plan C (types duplicated and require/import separated)
|
Wow, thanks for a quick reply! I have tested plan A (my one) and it works. I have tested your plan B, and it doesn't work, because the options listed are always tried first-to-last, and so because you put "require" before "types", the compiler just picks the "require" option and doesn't see the types. (However, it would work if you put "types" very first.) I have tested your plan C, and works. To me, it seems equally correct & tidy as plan A. I have no preference or suggestion between A and C. Thank you! |
@NWilson great! Could you give me your tsconfig.json or something? I could not reproduce the issue.
|
I have checked out your repo, and tested. I have two changes compared to your
|
I recently updated my tsconfig to use moduleResolution: NodeNext (which enables "exports" processing in package.json).
However, I am still producing CommonJS output using "module: NodeNext" in tsconfig with "type: commonjs".
This causes TypeScript to load the "require" branch in your exports, which has no typings:
You should export the typings for both require&import clients as follows:
The text was updated successfully, but these errors were encountered: