Skip to content

fix: use index.d.ts as types for cjs #2114

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

Conversation

kerwanp
Copy link
Contributor

@kerwanp kerwanp commented Jan 23, 2025

Changes

This pull request closes #2098. exports.require.types was pointing to a file that does not exist. It now points to the same exports.imports.types file (index.d.ts) fixing type issues when using this library with require.

How to Review

Types should properly resolved when using a require import.

@kerwanp kerwanp requested a review from a team as a code owner January 23, 2025 13:44
@kerwanp kerwanp requested a review from duncanbeevers January 23, 2025 13:44
@kerwanp kerwanp linked an issue Jan 23, 2025 that may be closed by this pull request
1 task
Copy link

changeset-bot bot commented Jan 23, 2025

🦋 Changeset detected

Latest commit: 21d3e6a

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

This PR includes changesets to release 1 package
Name Type
openapi-react-query 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

@kerwanp kerwanp added the openapi-react-query Relevant to openapi-react-query label Jan 23, 2025
Copy link

netlify bot commented Jan 23, 2025

Deploy Preview for openapi-ts canceled.

Name Link
🔨 Latest commit 21d3e6a
🔍 Latest deploy log https://app.netlify.com/sites/openapi-ts/deploys/679247dcc614f00008e86832

Copy link
Contributor

size-limit report 📦

Path Size
packages/openapi-fetch/dist/index.min.js 6.47 KB (0%)

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.

I think this will fix it as this only builds one file. But when packages have multiple files and they import from one another, you have to generate a separate set of types generally (or manually redeclare types for every file. Unbuild does a really good job with this though, and agree we should just switch all packages to using that.

@drwpow drwpow merged commit 0c35b32 into main Jan 25, 2025
14 checks passed
@drwpow drwpow deleted the 2098-build-output-is-missing-the-indexdcts-file-causing-typescript-to-fail branch January 25, 2025 19:53
@openapi-ts-bot openapi-ts-bot mentioned this pull request Jan 25, 2025
@marcomuser
Copy link
Contributor

Just letting you know that this doesn't work with typescript. The CJS output is now masquerading as ESM: https://arethetypeswrong.github.io/?p=openapi-react-query%400.3.1. The package.json was already correct. What needs to be done is to also publish the type declarations with .cts file extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openapi-react-query Relevant to openapi-react-query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build output is missing the index.d.cts file causing typescript to fail
3 participants