-
-
Notifications
You must be signed in to change notification settings - Fork 551
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
replace keyof ReactSVG
with SVGElementType
#2668
base: main
Are you sure you want to change the base?
Conversation
@aslilac Thanks for the heads-up. |
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.
Replace types with custom ones.
|
||
export type IconNode = [elementName: keyof ReactSVG, attrs: Record<string, string>][]; | ||
export type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][]; |
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.
export type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][]; | |
type ElementName = | |
'circle' | |
| 'ellipse' | |
| 'g' | |
| 'line' | |
| 'path' | |
| 'polygon' | |
| 'polyline' | |
| 'rect'; | |
export type IconNode = [elementName: ElementName, attrs: Record<string, string>][]; |
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.
Can you provide this list exactly?
The other elements are never used by the icon nodes we provide.
That sounds like a good call. I vendored in its definition, with links to the original source. |
Closes #2667
What is the purpose of this pull request?
Description
The
ReactSVG
type has been removed from @types/react 19. The suggested replacement (at least, for lucide's use case) is to useSVGElementType
instead.The two imports removed from createLucideIcon.ts were actually unused and do not need to be replaced.
The use of
import type
in lucide-react/src/types.ts brings it in sync with lucide-react-native/src/types.ts.Before Submitting