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

Use string union types instead of enums for better TypeScript compatibility with public config file type #322

Merged
merged 1 commit into from Dec 1, 2022

Conversation

bmish
Copy link
Owner

@bmish bmish commented Dec 1, 2022

This allows the user to use either the enums (available in ESM / when using this type internally) or just the plain string values (especially in CJS config files) without encountering TypeScript errors.

Fixes #321.

This also fixes the ability to use auto-complete on these types.

Website that suggests this solution: https://bobbyhadz.com/blog/typescript-convert-enum-to-union

@bmish bmish added the bug Something isn't working label Dec 1, 2022
@bmish bmish changed the title Use string union types instead of enums in public config file type Use string union types instead of enums for better TypeScript compatibility with config file type Dec 1, 2022
@bmish bmish merged commit 564d012 into main Dec 1, 2022
@bmish bmish deleted the array-enum-types branch December 1, 2022 21:30
@bmish bmish changed the title Use string union types instead of enums for better TypeScript compatibility with config file type Use string union types instead of enums for better TypeScript compatibility with public config file type Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config type definitions require the use of an enum
2 participants