Skip to content

feat: export types for icon names #1784

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

Closed

Conversation

peterlazar1993
Copy link
Contributor

@peterlazar1993 peterlazar1993 commented Jun 26, 2025

This is duplicate of #1761, I just merged master and fixed conflicts.

Feel free to close this PR if rather you merge from main.

See the conflict resolution here

@peterlazar1993 peterlazar1993 changed the title Export icon name type feat: export icon name type Jun 26, 2025
@peterlazar1993 peterlazar1993 changed the title feat: export icon name type feat: export types for icon names Jun 26, 2025
export type <%= className %><%= upperStyleName %>IconName = ComponentProps<typeof <%= upperStyleName %>Icon>['name'];
<% }) -%>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maybe redundant, please check

Copy link
Collaborator

@vonovak vonovak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, there's a more direct way to obtain the icon names, as noted in review.

Thank you

postScriptName: '<%= postScriptName %>',
fontFileName: '<%= fontFileName %>.ttf',
fontSource: require('../fonts/<%= fontFileName %>.ttf'), // eslint-disable-line @typescript-eslint/no-require-imports, global-require
});

export default Icon;
export type <%= className %>IconName = ComponentProps<typeof <%= className %>>['name'];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type <%= className %>IconName = ComponentProps<typeof <%= className %>>['name'];
export type <%= className %>IconName = keyof typeof glyphMap;

this should be faster for TS since it won't have to introspect the component props

@johnf
Copy link
Collaborator

johnf commented Jul 12, 2025

@peterlazar1993 thanks I updated the other PR with this and some other changes

@johnf johnf closed this Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants