-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
export default
generates JavaScript and declaration file incompatible
#58425
Comments
The code said |
I found an inconsistency between the generated JavaScript and the generated declaration file from the same TypeScript file. Files
Steps
Summary
|
This is a known issue with .d.ts files when cross-compiling module targets -- they don't say what their originating module settings were. If you're developing in ESM but shipping CJS+DTS, you'll need to be a bit more cautious (i.e. follow the docs) until this gets figured out. |
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
🔎 Search Terms
export, default, cjs, import
I found this issue #47455 that relates a little to the same subject.
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about default:
⏯ Playground Link
https://www.typescriptlang.org/play/?module=0#code/KYDwDg9gTgLgBAE2AMwIYFcA28BEyIQ4DcQA
💻 Code
🙁 Actual behavior
.js
.d.ts
🙂 Expected behavior
.js
.d.ts
(this file hasn't changed)🙃 Alternative expected behavior
.js
(this file hasn't changed).d.ts
Additional information about the issue
The JavaScript file and the declaration file are incompatible:
default
property:{ "default": "foo" }
"foo"
I discovered this problem when importing projects that use TypeScript:
linthtml()
function doesn't default export linthtml/linthtml#471The text was updated successfully, but these errors were encountered: