Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/types-resolution-from-main.fixed.md
Original file line number Diff line number Diff line change
@@ -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/<name>.js`/`.cjs` files and tsc-emitted `dist/<name>/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 `./<name>/index` folder path forces folder resolution and exposes types correctly. Subpath imports (`@policyengine/ui-kit/primitives`) were unaffected.
28 changes: 18 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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/<name>.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 `./<name>/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';