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 CJS build for TypeScript #1360

Merged
merged 3 commits into from
Sep 30, 2023
Merged

Conversation

marcomuser
Copy link
Contributor

Changes

Should fix #1346

  • Output CJS build in separate cjs subdirectory and copy the type declaration file as index.d.cts from the dist folder
  • Adjust package.json to point to correct builds/types for both cjs and esm

How to Review

This changes only the build output for CJS projects. I created a small repo in https://github.com/marcomuser/cjsts where the mentioned bug report is reproducible. It is fixed when I update the dist folder in node_modules with the built openapi-fetch from this branch.

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

@changeset-bot
Copy link

changeset-bot bot commented Sep 30, 2023

🦋 Changeset detected

Latest commit: e7d4620

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openapi-fetch Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@marcomuser marcomuser marked this pull request as ready for review September 30, 2023 10:23
Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

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

Thank you for this fix! I wasn’t aware the .d.cts was needed; I was under the false impression the type def worked for both. Fix seems great with me.

@drwpow drwpow merged commit b59e431 into openapi-ts:main Sep 30, 2023
6 checks passed
@github-actions github-actions bot mentioned this pull request Sep 30, 2023
diegohaz pushed a commit to ariakit/ariakit that referenced this pull request Oct 13, 2023
…ort (#2935)

Closes #2356

Taking this PR from another project as inspiration:
openapi-ts/openapi-typescript#1360

This should fix ariakit-react typing in Typescript projects using
NodeNext module/moduleresolution by explicitly pointing at a "cts" type
definition file. It should not bother existing use cases but I left
index.d.ts in the cjs module just in case.
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.

ESM is hell, how do we escape hell?
3 participants