Skip to content
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

dts resolve to CJS entry dts instead of ESM entry dts when not included in tsconfig #53958

Closed
loynoir opened this issue Apr 21, 2023 · 5 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@loynoir
Copy link

loynoir commented Apr 21, 2023

Bug Report

dts resolve to CJS entry dts instead of ESM entry dts when js not included in tsconfig

🔎 Search Terms

  • dts resolve priority
  • tsconfig
  • javascript
  • // @ts-check

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

Playground link with relevant code

💻 Code

await import('@sinclair/typebox')

https://github.com/loynoir/reproduce-typescript-53958

$ npm exec -- tsc --showConfig  | grep checkJs
        "checkJs": true
$ npm exec -- tsc --showConfig  | grep include -A 4
    "include": [
        "./src/**/*",
        "./test/**/*",
        "./reproduce2/**/*"
    ],

🙁 Actual behavior

  • ./reproduce1/test-esm-dts-resolve-1.mjs
  • ./reproduce1/test-esm-dts-resolve-2.mjs
  • ./reproduce1/test-mts-dts-resolve.mts

dts resolve to ./node_modules/@sinclair/typebox/cjs/typebox.d.ts

🙂 Expected behavior

dts resolve to ./node_modules/@sinclair/typebox/esm/typebox.d.ts

@loynoir loynoir changed the title dts resolve to CJS entry dts instead of ESM entry dts when js not included in tsconfig dts resolve to CJS entry dts instead of ESM entry dts when not included in tsconfig Apr 21, 2023
@RyanCavanaugh
Copy link
Member

The files in reproduce1 don't correspond to any tsconfig file, so nothing causes them to have moduleResolution: "nodenext" as is required to do node16 module resolution

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Apr 25, 2023
@microsoft-github-policy-service

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

1 similar comment
@microsoft-github-policy-service

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@microsoft-github-policy-service

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

1 similar comment
@microsoft-github-policy-service

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants