-
Notifications
You must be signed in to change notification settings - Fork 22
Convert icons to Typescript #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR converts the icons package (src/icons folder only) to TypeScript. The package has been published as v1.2.1 and is already in use in the Seller app. The conversion adds proper type safety for React SVG components while maintaining backward compatibility.
Key Changes:
- Converted helper files from JavaScript to TypeScript with proper type definitions
- Added TypeScript types to all icon components (props: React.SVGProps)
- Added build configuration (tsconfig.json, vite.config.js) for TypeScript compilation
- Maintained existing functionality while adding type safety
Reviewed changes
Copilot reviewed 21 out of 243 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/icons/tsconfig.json |
TypeScript configuration for the icons package with React support |
src/icons/vite.config.js |
Build configuration using Vite with TypeScript plugin for declaration generation |
src/icons/postcss.config.js |
PostCSS configuration for Tailwind CSS processing |
src/icons/src/helpers/icon.tsx |
Converted to TypeScript with proper type definitions for IconProps and IconComponent |
src/icons/src/helpers/iconSizes.ts |
Converted to TypeScript with const assertion for type safety |
src/icons/src/helpers/classnames.js |
New utility function for merging Tailwind classes |
src/icons/src/images/*.tsx |
All image components updated with React.SVGProps types |
src/icons/src/*.tsx |
All icon components updated with proper TypeScript types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Change React peerDependency from ^18.3.1 to >=17 - Allows icons package to work with React 17, 18, 19, and future versions - Provides better compatibility for projects on different React versions
- Downgraded Vite to v4.5.3 for Node 16 support - Downgraded vite-plugin-dts, @xola/jslint, and eslint to compatible versions - Added postcss-load-config override to ensure Node 16 compatibility - Converted postcss.config.js from ES module to CommonJS format - Package now exports both CJS and ESM formats for maximum compatibility
Update all icon imports from `from "../../icons"` to `from "../../icons/index.js"` to prevent Vite from treating src/icons as a package during build.
- Added ignorePatterns to .xo-config.json for src/icons and src/stories - Simplified lint scripts in package.json by removing redundant --ignore flags - Configuration now centralized in .xo-config.json file
- Fixed import order in ComboBox.jsx - Changed clsx import to named export in LocalizedDayPicker.tsx - Auto-fixed formatting issues (spacing, line breaks) - Auto-fixed switch case braces in GooglePlacesAutocomplete.jsx - Auto-fixed prefer-at and prefer-string-replace-all issues - Auto-fixed import type issues in TypeScript files
45e9344 to
951609b
Compare
Converts the icons package (
src/icons) to TypeScript and separates it from the main UI Kit package.Changes
.jsxto.tsxwith proper TypeScript types@xola/ui-kitpackage - icons now only available via@xola/iconsPackage Sizes
Published
This
@xola/iconspackage is already published on NPM as v1.2.4 and raised as a PR in the Seller app: https://github.com/xola/x2-seller/pull/6360