From 14b267cc8ef2036b3f403c5052eef3047319733a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 9 May 2026 09:33:35 -0400 Subject: [PATCH] Apply types-resolution fix to legacy/ subpath too The 0.8.1 fix in #29 only patched the main-entry re-exports. The same file-shadowing-folder ambiguity affected src/legacy/index.ts, where 'export * from "./tokens"' was silently dropping every legacy color/ typography/spacing/chartColors symbol from `@policyengine/ui-kit/legacy`. Mirror the fix: pin the re-exports to './tokens/index' and './charts/index'. Verified with a fresh tsc --noEmit against a file:-installed build. Co-Authored-By: Claude Opus 4.7 (1M context) --- changelog.d/legacy-types-resolution.fixed.md | 1 + src/legacy/index.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelog.d/legacy-types-resolution.fixed.md diff --git a/changelog.d/legacy-types-resolution.fixed.md b/changelog.d/legacy-types-resolution.fixed.md new file mode 100644 index 0000000..2f1ec2f --- /dev/null +++ b/changelog.d/legacy-types-resolution.fixed.md @@ -0,0 +1 @@ +`@policyengine/ui-kit/legacy` types now resolve correctly under TypeScript `bundler` resolution. Same root cause as 0.8.1's main-entry fix: `src/legacy/index.ts` re-exported `'./tokens'` and `'./charts'`, but Vite's multi-entry build emits `dist/legacy/tokens.js` and `dist/legacy/charts.js` siblings to the tsc-emitted `dist/legacy/tokens/index.d.ts` and `dist/legacy/charts/index.d.ts` folders. With both shapes on disk, TS's `bundler` resolver picks the file (no types) over the folder. Pinning to `'./tokens/index'` and `'./charts/index'` forces folder resolution. diff --git a/src/legacy/index.ts b/src/legacy/index.ts index 392bd3b..f1df1dc 100644 --- a/src/legacy/index.ts +++ b/src/legacy/index.ts @@ -28,5 +28,10 @@ * This module will be removed in a future major release once consumers migrate. */ -export * from "./tokens"; -export * from "./charts"; +// Subpath re-exports use explicit `/index` to dodge the same +// file-shadowing-folder ambiguity fixed in src/index.ts. Without the +// `/index` pin, TypeScript's `bundler` resolution picks the Vite-emitted +// `dist/legacy/tokens.js` over the tsc-emitted `dist/legacy/tokens/index.d.ts` +// and silently drops the re-exports. +export * from "./tokens/index"; +export * from "./charts/index";