You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(packaging): resolve correct .d.cts types for CJS consumers
Each package shipped a single top-level "types" in its exports map
pointing at the ESM `.d.ts`. Because every package is `"type": "module"`,
TypeScript's node16/nodenext resolution interprets that declaration as
ESM, so CommonJS consumers (moduleResolution node16/nodenext) cannot
import the packages:
- TS1479 on value imports
- TS1541 on type-only imports
The matching `.d.cts` declarations are already emitted by tsup but were
never referenced. Nest the `types` condition under each `import`/`require`
branch so CJS consumers resolve `.d.cts` and ESM consumers resolve `.d.ts`.
This is purely additive to type resolution — runtime entries and ESM
consumers are unchanged.
Verified with @arethetypeswrong/cli (all green across node10, node16
from CJS and ESM, and bundler) and against a real CommonJS + node16
consumer build.
Fixes#748
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments