Fix types declaration entry path for clients/js - #647
Merged
joncinque merged 1 commit intoAug 28, 2026
Conversation
The package's `types` (and the `types` export condition) point to `./dist/types/index.d.ts`, but the build emitted the entry to `./dist/types/src/index.d.ts`, so consumers resolved no type declarations at all (attw: "No types" on node10, node16, and bundler). The cause was `include: ["src", "*.ts"]`: the `*.ts` glob pulled in `tsup.config.ts` at the package root, which raised the declaration rootDir to the package directory and prefixed all emitted declarations with `src/`. Setting `rootDir: "src"` and narrowing `include` to `["src"]` makes tsc emit the entry to the declared `./dist/types/index.d.ts`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
joncinque
approved these changes
Aug 28, 2026
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
clients/js(@solana-program/token-wrap) ships no usable type declarations.package.jsondeclares:…but
pnpm buildactually emits the entry to./dist/types/**src**/index.d.ts. The declared path doesn't exist and there is no co-located.d.tsnext to the JS (declarations useemitDeclarationOnly+declarationDir), so TypeScript consumers resolve nothing.@arethetypeswrong/clibefore:Cause
tsconfig.jsonhadinclude: ["src", "*.ts"]. The*.tsglob matchestsup.config.tsin the package root, which raises the computed declarationrootDirto the package directory — so every emitted declaration gets an extrasrc/path segment (dist/types/src/index.d.ts, plus a straydist/types/tsup.config.d.ts).Fix
Pin the declaration root to
srcand stop compiling the root-level config file into the declaration output:Now
tscemits the entry to the declared./dist/types/index.d.ts(and drops the straytsup.config.d.ts). The JS build (tsup) is unchanged.@arethetypeswrong/cliafter:Note on the remaining
🎭The single emitted
dist/types/index.d.tsis CJS-flavored (the package is"type": "commonjs"), so an ESM consumer sees a CJS-shaped declaration for the.mjsentry. This is a pre-existing, much milder issue (it was masked by the "No types" failure) and is common to the tsc-single-.d.tsbuild style used across these clients. Fully resolving it needs a dual.d.ts/.d.mtsdeclaration setup, which is a broader build change; I've kept this PR to the critical fix (consumers now actually get types). Happy to follow up on the dual-declaration setup if desired.Verification
pnpm buildsucceeds;dist/types/index.d.tsexists with the full public API;pnpm lint/pnpm format:checkunaffected (no source changes).🤖 Generated with Claude Code