diff --git a/changelog.d/types-resolution-from-main.fixed.md b/changelog.d/types-resolution-from-main.fixed.md new file mode 100644 index 0000000..9b4b9b8 --- /dev/null +++ b/changelog.d/types-resolution-from-main.fixed.md @@ -0,0 +1 @@ +Main-entry type re-exports now resolve from a TypeScript `bundler` consumer. Since 0.4.0 the dist/ tree contains both Vite-emitted `dist/.js`/`.cjs` files and tsc-emitted `dist//index.d.ts` folders side by side. With both on disk, TypeScript's `bundler` module resolution prefers the file over the folder and reports `Module '"@policyengine/ui-kit"' has no exported member 'Badge'` (and the same for every primitive/layout/charts/visualization/inputs/display/utils/assets symbol) from the main entry. Pinning the source re-exports to the explicit `.//index` folder path forces folder resolution and exposes types correctly. Subpath imports (`@policyengine/ui-kit/primitives`) were unaffected. diff --git a/src/index.ts b/src/index.ts index 2309683..34f909d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,32 +1,40 @@ // Styles — consumers must import '@policyengine/ui-kit/styles.css' separately import './theme/tokens.css'; +// Subpath re-exports use explicit `/index` so the emitted .d.ts resolves +// past the multi-entry `dist/.js` siblings produced by Vite. With both +// `dist/primitives.js` (Vite output) and `dist/primitives/index.d.ts` (tsc +// output) on disk, TypeScript's `bundler` resolution prefers the file over +// the folder and reports "no exported member" from the main entry. Pinning +// the path to `.//index` forces folder resolution and exposes the +// types correctly. See https://github.com/microsoft/TypeScript/issues/52146 + // Runtime tokens (colors, palette, chartColors, typography, …) -export * from './theme'; +export * from './theme/index'; // Types -export * from './types'; +export * from './types/index'; // Utilities -export * from './utils'; +export * from './utils/index'; // Primitives -export * from './primitives'; +export * from './primitives/index'; // Layout -export * from './layout'; +export * from './layout/index'; // Inputs -export * from './inputs'; +export * from './inputs/index'; // Display -export * from './display'; +export * from './display/index'; // Charts -export * from './charts'; +export * from './charts/index'; // Visualization -export * from './visualization'; +export * from './visualization/index'; // Assets -export * from './assets'; +export * from './assets/index';