Skip to content

fix: point package types at dist where the build emits them#38

Open
imharjot wants to merge 1 commit into
jonschlinkert:masterfrom
imharjot:fix/types-dist-path
Open

fix: point package types at dist where the build emits them#38
imharjot wants to merge 1 commit into
jonschlinkert:masterfrom
imharjot:fix/types-dist-path

Conversation

@imharjot

Copy link
Copy Markdown

The build emits type declarations to dist/index.d.ts and dist/index.d.mts, but package.json still pointed the top-level types field and the "." export's types condition at the root ./index.d.ts. Only dist is published (files: ["dist"]), so that path isn't in the tarball and TypeScript resolves no declarations — consumers of get-value get no types.

This points the declarations at where the build actually emits them:

  • top-level typesdist/index.d.ts
  • the "." export split into import/require conditions, each with its types pointing at the matching file (dist/index.d.mts for ESM, dist/index.d.ts for CJS)

The mismatch was introduced when the build output moved into dist/ (#31) without updating the type pointers.

Closes #37

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).
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.

index.d.ts is located in a wrong directory

1 participant