-
Notifications
You must be signed in to change notification settings - Fork 28
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
Types not found when moduleResolution: node16
is set for typescript
#177
Comments
Based on telegraf/telegraf@6ddc397 I think we can do something very similar to #158, but also for the If you are familiar with how to repack npm bundles and use It would be ideal if we could re-use the same index.d.ts file for all the references in |
Based on your repro, you aren't using CJS require, you are using ESM imports, no?
is ESM, not CJS? |
Well, this is the tricky part. Although it looks like an esm static import, with these settings it gets transpiled to require by typescript if I am not mistaken. |
Describe the bug
Getting
when trying to import in a project with
moduleResolution: node16
.To Reproduce
package.json
tsconfig.json
main.ts
and then run:
Output I get:
Additional context
My intent in this example is to import Temporal using require, and this is what's happening, but typescript doesn't seem to pick up the
.d.ts
file.Typescripts esm support is not without controversies. One of them is that they are more strict about the location of
.d.ts
files: microsoft/TypeScript#49160 . The most straightforward solution seems to be moving and duplicatingindex.d.ts
todist/index.d.cts
,dist/index.esm.d.ts
anddist/index.umd.d.ts
, but there might be better ways I am not aware of.The text was updated successfully, but these errors were encountered: