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

fix: Creates CJS type declarations for CJS export. #138

Merged
merged 1 commit into from
Apr 26, 2024
Merged

fix: Creates CJS type declarations for CJS export. #138

merged 1 commit into from
Apr 26, 2024

Conversation

nzakas
Copy link
Contributor

@nzakas nzakas commented Apr 15, 2024

Added an additional tsconfig file that just outputs a CJS version of the .d.ts file to accompany the CJS version of the module.

fixes #136

@nzakas nzakas requested a review from boneskull April 15, 2024 23:50
@nzakas
Copy link
Contributor Author

nzakas commented Apr 19, 2024

@boneskull what do you think of this approach to generating types for the CommonJS entrypoint?

@boneskull
Copy link
Collaborator

OK, I think this is fine.

I wonder if there is a rollup-adjacent tool that'd help w/ shipping dual-module-system packages.

I use tshy for this, which just uses tsc instead of a bundler. It also provides an escape-hatch for ES-specific stuff (e.g., import.meta).

Copy link
Collaborator

@boneskull boneskull left a comment

Choose a reason for hiding this comment

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

lgtm

@nzakas nzakas merged commit 26b6eb7 into main Apr 26, 2024
18 checks passed
@nzakas nzakas deleted the issue136 branch April 26, 2024 23:11
@boneskull
Copy link
Collaborator

@nzakas You know, I think we can just copy dist/env.d.ts to dist/env.d.cts and it should work. I don't think we need to run tsc again.

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.

TypeScript cannot find typings for CommonJS version of this package
2 participants