-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
IconNameSubset
duplicate name issue when using multiple icon sets
#91
Comments
An issue was encountered while updating to the latest version of svg-to-ts, this commit pins it to a specific version. An [issue](nivekcode/svg-to-ts#91) is raised against the svg-to-ts repo, depending on the outcome we can either workaround it locally or help provide a fix.
An issue was encountered while updating to the latest version of svg-to-ts, this commit pins it to a specific version. An [issue](nivekcode/svg-to-ts#91) is raised against the svg-to-ts repo, depending on the outcome we can either workaround it locally or help provide a fix.
IconNameSubset
duplicate name issue when using multiple icon sets
An issue was encountered while updating to the latest version of svg-to-ts, this commit pins it to a specific version. An [issue](nivekcode/svg-to-ts#91) is raised against the svg-to-ts repo, depending on the outcome we can either workaround it locally or help provide a fix.
An issue was encountered while updating to the latest version of svg-to-ts, this commit pins it to a specific version. An [issue](nivekcode/svg-to-ts#91) is raised against the svg-to-ts repo, depending on the outcome we can either workaround it locally or help provide a fix.
Hi @thatguynamedandy Thx a lot for reporting this issue. You are absolutely right. That's an error on our site. We didn't think of the combination of the helper type So yes - we need to find a solution for this.
The first option is the easiest to realize. But then you would have two helper types with different names that do the same. Disabling them would also be easy to realize. But then you need to be aware of enabling and disabling them. Generating them into a directory also would only be helpful in combination with option two. Thoughts? I will also try to think again about the 3 options. Maybe there's an even better way. |
An issue was encountered while updating to the latest version of svg-to-ts, this commit pins it to a specific version. An [issue](nivekcode/svg-to-ts#91) is raised against the svg-to-ts repo, depending on the outcome we can either workaround it locally or help provide a fix.
After looking into it I think it makes sense to add a name prefix and also an option to disable it. So basically I would even switch to disable it by default which would be a breaking change. |
I saw that you forked the repository. Are you already working on this or should I take a look? |
I'll endeavour to take a look if thats ok? I spent a bit of time looking into some options with typescript but didn't achieve too much. I was trying to focus on the ideal outcome and seeing how we might get there. I wondered if the ideal option would be this. export type IconNameSubset<T extends Readonly<BrandIcon[]|Icon[]>> = T[number]['name']; Which would allow us to use the same export type someIcons = IconNameSubset<[typeof myIconA, typeof myIconB]>; ✅
export type someBrandIcons = IconNameSubset<[typeof brandIconA, typeof brandIconB]>; ✅
export type thumbBrandIcons = IconNameSubset<[typeof myIconA, typeof brandIconA]>; ❌ //no mixing of types However I don't think there is anyway of doing this as the two icons are run on completely independent commands and I couldn't think of a clever typescript way of achieving that outcome. So the option that you mentioned may be easiest, would it make sense to use the export type ${interfaceName}NameSubset<T extends Readonly<${interfaceName}[]>> = T[number]['name']; This way we wouldn't need to add any more options and it would still always export a uniquely named type helper. It would be a breaking change though. Depending upon the appetite for breaking changes we could avoid it by adding an interim option |
BREAKING CHANGE: The `IconNameSubset` helper is now dynamically generated based off of the `interfaceName` property. Any references to this will need updating. fix nivekcode#91
BREAKING CHANGE: The `IconNameSubset` helper is now dynamically generated based off of the `interfaceName` property. Any references to this will need updating. fix nivekcode#91
Above is one possible approach, only raised as a draft more than happy to alter it. |
Hi @thatguynamedandy Thanks a lot for the explanation and the draft. I think this is the best solution. In case somebody needs to have the same Icons he could still do the following:
This should then automatically release v6.0.0. |
Thx a lot for your effort 👍 |
Hi @kreuzerk I moved the PR out of draft, I think the commit message should match the syntax already, I didn't add the optional scope as I noticed it wasn't present in much of the history, but happy to add one. |
Awesome. Thx a lot 👍 . Great work! |
@all-contributors please add @thatguynamedandy for code, bugs, doc, ideas |
@kreuzerk I've put up a pull request to add @thatguynamedandy! 🎉 |
BREAKING CHANGE: The `IconNameSubset` helper is now dynamically generated based off of the `interfaceName` property. Any references to this will need updating. fix nivekcode#91
BREAKING CHANGE: The `IconNameSubset` helper is now dynamically generated based off of the `interfaceName` property. Any references to this will need updating. fix nivekcode#91
# [6.0.0](v5.7.1...v6.0.0) (2020-12-06) ### Bug Fixes * 🐛 ensures name subset helper always has a unique name ([d1a5d69](d1a5d69)), closes [#91](#91) * 🐛 start spinner on generation start ([6f34ab0](6f34ab0)) ### Features * 🎸 add verbose logging feature ([068eb1f](068eb1f)) * 🎸 logging steps with spinners ([55d7685](55d7685)) ### BREAKING CHANGES * The `IconNameSubset` helper is now dynamically generated based off of the `interfaceName` property. Any references to this will need updating.
🎉 This issue has been resolved in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
There was a [slight issue](nivekcode/svg-to-ts#91) with a minor version change in svg-to-ts. We temporarily pinned the version, but the issue has now been resolved.
There was a [slight issue](nivekcode/svg-to-ts#91) with a minor version change in svg-to-ts. We temporarily pinned the version, but the issue has now been resolved. fix Legal-and-General#88
There was a [slight issue](nivekcode/svg-to-ts#91) with a minor version change in svg-to-ts. We temporarily pinned the version, but the issue has now been resolved. fix #88
Hi, I believe we may have uncovered a potential breaking change while making a switch from 5.0.1 to 5.7.1, or alternatively it may be a misuse from our side.
In our project we have two sets of icons,
icons
andbrand-icons
. We isolate the two by running different svg-to-ts commands and generating separate files.this change in v5.6.0 which introduced the
IconNameSubset
causes us a bit of an issue is we now have two exported types with the same name.There are probably a few things we could to fix it in our project, but I thought I would raise it here first to see if you think it had any validity as a bug. If so I'm happy to raise a PR to try and fix it.
One route would be to provide some kind of cli option to prefix the type in the same way it's done for the interface name. With a new option a breaking change could be avoided by deferring back to the default if no option is provided, the downside is that it might be a bit of an obscure option.
The text was updated successfully, but these errors were encountered: