Skip to content
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

Consider alternatives for types on StyleDictionary configuration #11

Open
d01000100 opened this issue Mar 3, 2023 · 0 comments
Open
Labels
code style Improve the legibility or structure of working code priority:low question Further information is requested

Comments

@d01000100
Copy link
Owner

StyleDictionary receives the custom logic of its pipeline (transformer, transform groups, formatters, fileHeaders) on a javascript object. (The object is constructed on src/style-dictionary/config.ts)

To add custom logic, we must first register it with a name and add a name to the configuration file.

In order to ease the tracking and reuse of these names, we create enum types of the names (src/style-dictionary/types.ts).

According to the typing convention we are working with, these enums should be string arrays and union types. However, the function in which we use these types (when registering the logic and when creating the config file) both receive any string. So there will be no autocomplete for the developers if we use a union type in those contexts.

Consider if we should use an enum in this case or if we should stick with the enum.

@d01000100 d01000100 added question Further information is requested priority:low code style Improve the legibility or structure of working code labels Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code style Improve the legibility or structure of working code priority:low question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant