-
Notifications
You must be signed in to change notification settings - Fork 0
Add TypeScript declaration files for proper TypeScript support #41
Description
Issue Description
The @etherisc/ui-kit package (v0.2.1) is missing TypeScript declaration files (.d.ts), causing TypeScript compilation errors in projects that use the package.
Current Behavior
When importing components from @etherisc/ui-kit in a TypeScript project:
import { Select, Button, DataTable } from '@etherisc/ui-kit';TypeScript throws errors:
error TS7016: Could not find a declaration file for module '@etherisc/ui-kit'.
'/workspace/node_modules/@etherisc/ui-kit/dist/ui-kit.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/etherisc__ui-kit` if it exists or add a new declaration (.d.ts) file containing `declare module '@etherisc/ui-kit';`
Expected Behavior
The package should include TypeScript declaration files so that:
- TypeScript projects can use the package without compilation errors
- Developers get proper type checking and IntelliSense support
- Component props are properly typed for better development experience
Environment
- Package version: @etherisc/ui-kit@0.2.1
- TypeScript version: Latest
- Build tool: Vite with TypeScript
Suggested Solution
-
Add TypeScript declarations to the build process
- Include .d.ts files in the dist/ directory
- Update package.json to reference the types:
"types": "./dist/index.d.ts"
-
Ensure proper exports
- All components (Button, Select, DataTable, etc.) should have proper type exports
- Hook functions (useToast, useToastContext) should have typed return values
-
Example package.json structure:
{ "name": "@etherisc/ui-kit", "version": "0.2.1", "main": "./dist/ui-kit.umd.cjs", "module": "./dist/ui-kit.js", "types": "./dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/ui-kit.js", "require": "./dist/ui-kit.umd.cjs" } } }
Additional Context
This issue prevents proper TypeScript integration and forces developers to either:
- Use // @ts-ignore everywhere
- Create custom declaration files that may become outdated
- Disable TypeScript strict mode
Adding proper TypeScript support would greatly improve the developer experience and make the package more suitable for enterprise TypeScript projects.
Related
This follows up on issue #39 regarding the Select component export, which was resolved. Now we need the TypeScript declarations to complete the proper package support.