Skip to content

fix(build): bundle declarations so types resolve under NodeNext (0.95.1)#267

Merged
drewstone merged 1 commit into
mainfrom
chore/dts-nodenext-resolution
Jun 21, 2026
Merged

fix(build): bundle declarations so types resolve under NodeNext (0.95.1)#267
drewstone merged 1 commit into
mainfrom
chore/dts-nodenext-resolution

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

Problem

0.95.0 switched declaration emit from tsup-bundled (dts: true) to tsc --emitDeclarationOnly + a flat-alias step. tsc emits per-module .d.ts with extensionless relative re-exports (e.g. export { runJudgeFleet } from './judge-runner').

Under a consumer's moduleResolution: NodeNext/node16, those specifiers do not resolve — NodeNext requires an explicit extension and a runtime sibling, which bundled declarations don't have. When the relative module fails to resolve, every re-exported value collapses to any, so consumers' typed callbacks (ProposeFn/VerifyFn/ReviewFn, runJudgeFleet results) lose their parameter types — a noImplicitAny cascade with no consumer-side fix (the named types themselves resolve to any).

0.77.0 and earlier shipped a single self-contained bundled index.d.ts (tsup dts: true), so this never surfaced. The regression is purely in the declaration packaging, not the API.

Change

Restore dts: true and drop the tsc --emitDeclarationOnly + emit-declaration-aliases step from the build. tsup bundles declarations into chunk files whose relative specifiers carry .js extensions and have both a runtime and a declaration sibling — resolving cleanly under NodeNext, node16, and bundler alike. tsup already emits every exports-map types target directly, so the flat-alias step is dead.

Diff is 4 files: tsup.config.ts (dts: falsetrue), package.json (build script + version), and the Python version trio.

Verification

  • pnpm build / verify:package / typecheck / lint green; 2500 tests pass.
  • Built the new declarations and pointed a real NodeNext consumer (starter-foundry, moduleResolution: NodeNext) at them: 23 noImplicitAny errors → 0, with zero source changes in the consumer.
  • New index.d.ts relative specifiers all carry .js extensions (73/73); the broken standalone propose-review.d.ts/judge-runner.d.ts are gone (bundled into chunks).

Release

Patch 0.95.1 (version trio bumped). Additive packaging fix — no API change; unblocks every NodeNext consumer.

0.95.0 switched declaration emit from tsup-bundled (`dts: true`) to
`tsc --emitDeclarationOnly` + flat aliases. tsc emitted per-module
`.d.ts` with extensionless relative re-exports (`export { X } from
'./judge-runner'`). Under a consumer's `moduleResolution: NodeNext`
those specifiers do not resolve (NodeNext requires an extension and
a `.js` runtime sibling, which bundled declarations lack), so every
re-exported value collapses to `any` and consumers' typed callbacks
(`ProposeFn`/`VerifyFn`/`ReviewFn`, `runJudgeFleet` results) lose
their parameter types — a noImplicitAny cascade with no consumer-side
fix.

Restore `dts: true`: tsup bundles declarations into chunk files with
`.js`-extensioned specifiers that have both a runtime and a declaration
sibling, resolving cleanly under NodeNext, node16, and bundler alike.
The flat-alias step is no longer needed — tsup emits every exports-map
`types` target directly.

Verified: a NodeNext consumer (starter-foundry) goes from 23
noImplicitAny errors to 0 against the rebuilt types, with no source
change.

Version 0.95.1.

@tangletools tangletools left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Auto-approved PR — 98fd3acb

Blanket team auto-approval is enabled for this reviewer service.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.

tangletools · auto-approval · reason: blanket_auto_approve · 2026-06-21T14:42:08Z

@drewstone drewstone merged commit 545c9b3 into main Jun 21, 2026
1 check failed
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.

2 participants