Skip to content

fix: unable to find TS types under ESM #142

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

Merged
merged 1 commit into from
Sep 12, 2024
Merged

Conversation

marvinhagemeister
Copy link
Member

Noticed that the types weren't found under ESM. TypeScript these days needs separate declaration files for ESM and CJS. With the help of https://arethetypeswrong.github.io/ the changes in this PR ensure that types can be found in all scenarios.

Fixes denoland/deno#25529

"import": "./dist/esm/index.mjs",
"require": "./dist/cjs/index.js"
},
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"types": "dist/cjs/index.d.ts",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used by Node <10, which only supports CJS anyway.

@marvinhagemeister marvinhagemeister merged commit fcac66b into main Sep 12, 2024
1 check passed
@marvinhagemeister marvinhagemeister deleted the esm-ts-types branch September 12, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Types cannot call function in @preact/preset-vite
2 participants