Skip to content

fix: avoid TS2742 in generated client under pnpm isolated node_modules#1496

Open
PBRT wants to merge 1 commit into
graffle-js:mainfrom
PBRT:fix/export-types
Open

fix: avoid TS2742 in generated client under pnpm isolated node_modules#1496
PBRT wants to merge 1 commit into
graffle-js:mainfrom
PBRT:fix/export-types

Conversation

@PBRT
Copy link
Copy Markdown

@PBRT PBRT commented May 26, 2026

The generated create function had an inferred return type that transitively referenced @wollybeard/kit internals through subpath barrels TypeScript could not portably name when emitting declarations under pnpm's isolated node_modules layout, producing TS2742 errors in consumer projects.

  • Export the Create type from the main client entry so the generator can refer to it by a portable name.
  • Make the generator emit a type-only import of Create and annotate the generated create with Create<typeof context>, giving the emitted declaration a nameable return type.
  • Expose the build/* subpaths referenced by the generated declaration via package.json exports so consumers can actually resolve them.

Refs #1484

The generated `create` function had an inferred return type that transitively
referenced `@wollybeard/kit` internals through subpath barrels TypeScript
could not portably name when emitting declarations under pnpm's isolated
node_modules layout, producing TS2742 errors in consumer projects.

- Export the `Create` type from the main client entry so the generator can
  refer to it by a portable name.
- Make the generator emit a type-only import of `Create` and annotate the
  generated `create` with `Create<typeof context>`, giving the emitted
  declaration a nameable return type.
- Expose the `build/*` subpaths referenced by the generated declaration via
  `package.json` `exports` so consumers can actually resolve them.

Refs graffle-js#1484
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.

1 participant