fix: point package types at dist where the build emits them#38
Open
imharjot wants to merge 1 commit into
Open
Conversation
The build (tsup) emits declarations to dist/index.d.ts and dist/index.d.mts, but package.json still pointed "types" and the "." export's types condition at the root ./index.d.ts. Since only "dist" is published (files: ["dist"]), that path is absent from the tarball and TypeScript resolves no declarations for consumers. Set top-level "types" to dist/index.d.ts and split the "." export into import/require conditions, each pointing its types at the matching emitted declaration (dist/index.d.mts for ESM, dist/index.d.ts for CJS).
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.
The build emits type declarations to
dist/index.d.tsanddist/index.d.mts, butpackage.jsonstill pointed the top-leveltypesfield and the"."export'stypescondition at the root./index.d.ts. Onlydistis published (files: ["dist"]), so that path isn't in the tarball and TypeScript resolves no declarations — consumers ofget-valueget no types.This points the declarations at where the build actually emits them:
types→dist/index.d.ts"."export split intoimport/requireconditions, each with itstypespointing at the matching file (dist/index.d.mtsfor ESM,dist/index.d.tsfor CJS)The mismatch was introduced when the build output moved into
dist/(#31) without updating the type pointers.Closes #37