fix(types): declare types condition in exports for ESM consumers#2815
Open
mattconcord wants to merge 1 commit into
Open
fix(types): declare types condition in exports for ESM consumers#2815mattconcord wants to merge 1 commit into
mattconcord wants to merge 1 commit into
Conversation
Add `types` condition to the `.` exports entry in both `openapi-fetch` and `openapi-typescript` packages so that modern TypeScript / tsgo (Go-rewritten compiler) can resolve types deterministically from the `dist/index.d.ts` files the packages already ship. Without an explicit `types` condition, packages with `"type": "module"` fall back to the legacy sibling-`.d.ts` resolver, which tsgo is tightening against. No behavioral change — pure manifest fix, two lines per package.
👷 Deploy request for openapi-ts pending review.Visit the deploys page to approve it
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Under modern TypeScript / tsgo (Go-rewritten compiler), packages with
"type": "module"and no explicitexports.typescondition fail to resolve types because the legacy sibling-.d.tsfallback is being removed.Both
openapi-fetchandopenapi-typescriptcurrently have no"types"condition in theirexportsmap, causing TypeScript consumers to potentially see type resolution issues as tsgo tightens its module resolution.Fix
One line added to each package's
package.json:packages/openapi-fetch/package.json:"types": "./dist/index.d.ts"as first condition inexports."."packages/openapi-typescript/package.json:"types": "./dist/index.d.ts"as first condition inexports."."Both point at the
.d.tsdeclaration files the packages already ship indist/. The"types"condition must come first (TypeScript's resolver reads conditions in declared order).Impact
importanddefaultconditions) benefit from the same declaration file