-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
key type and name missmatch if icon has _ in filename #143
Comments
|
Do you want to open a PR? It's may related to: https://github.com/ngneat/svg-icon/blob/master/svg-generator/tree.ts#L86 |
I am investigating rn, as far as my tests go, the change from snake_case to kebab-case is happening here in the AST: Line 32 in bcceb6e
|
That's correct. This code needs to be changed. |
Now I am unsure how to proceed:
1 would be a breaking change, 2 is backwards compatible, but keeps the not really necessary change in key. |
What about changing window_restore_solid.ts to window-restore-solid.ts? |
this is just a testfile here, our icons come from an npm package that I have no control over |
I mean in the generated code |
isn't that also a breaking change, since all imports of _ based icon filenames will then be broken after regeneration? |
changing the name here would be an option (still breaking change): svg-icon/svg-generator/tree.ts Line 71 in bcceb6e
|
Can you list the possible options, please? |
so, as far as I can see, we have 3 options:
|
I think we can go with option 2 for now |
fix(svg-generator): add kebab-case transform to type generator (#143)
I'm submitting a...
Current behavior
I am having several icons with _ in the name, e.G.: "window_restore_solid.svg"
SVGGenerator creates a similar file "window_restore_solid.ts", which is fine. However, the name field is then "window-restore-solid" instead of "window_restore_solid". The key has a type of "window_restore_solid" | ... so every file with an _ does not work or shows a type missmatch in IDEs like Webstorm.
The problem occurs when the svg generator creates the types.d.ts file inside the node_modules @ngneat/svg-icons/lib folder.
cat node_modules/@ngneat/svg-icon/lib/types.d.ts export declare type SvgIcons = 'window_restore_solid';
Expected behavior
key type and name property should be the same
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/stackblitz-starters-tmwzwm?file=icons/window_restore_solid.ts
(for whatever reason you cannot have an angular project and a terminal to run the svg-generator so typechecking in stackblitz angular template is limited. Webstorm however will use this type)
you can type
cat node_modules/@ngneat/svg-icon/lib/types.d.ts
to get the type generated after you runnpm run svg
Environment
The text was updated successfully, but these errors were encountered: