-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat(lib): allow strong typing for icons #15
Conversation
This seems fine, and is a nice improvement. I'm curious about devtime performance — does LSP still feel snappy with a hefty mapped type like |
It feels normal in Neovim + LSP. Not super fast, not super slow either. |
Feels good on my end. Please also update the codegen script that creates the https://github.com/phosphor-icons/core/blob/main/scripts/catalog.ts#L41-L107 |
Sure, I think I missed that. Will commit later. |
@rektdeckard I just made a new commit, please review it. |
Thanks for the contrib! |
Thanks for merging my PR! |
I'm writing some additional docs, will publish this evening |
This PR adds a
const
constraint to theicons
array exported bysrc/icons.ts
, so the Typescript compiler will emit a much more useful declaration file which can later be used to strictly type valid icon names. It also exports a newPhosphorIcon
type.Instead of emitting this in `dist/icons.d.ts:
With this PR the following will be emitted:
Now the following becomes possible:
I believe this will hardly break anything. If it does, a separated export can be added.