Skip to content

Conversation

@rickdunkin
Copy link
Contributor

I would like to be able to use the useTypeImports: true option while also mocking enums. I can use the enumsAsTypes: true option, but the enum isn't currently imported as a type, and the string literal isn't typed correctly as the appropriate enum.

I've added a new option castEnumsAsTypes to be used along with enumsAsTypes in order to cast the string values of enums to their correct type. Maybe this shouldn't be a separate option, or perhaps the option should have a different name. I considered having this functionality be the default if both useTypeImports and enumsAsTypes are true, but I went with a new option as I don't know how folks are using this library.

Copy link
Owner

@ardeois ardeois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution.
I think there is no need for adding a new option. useTypeImports is quite new and I wouldn't mind to have enums imported as types if useTypeImports and enumsAsTypes are true

@rickdunkin
Copy link
Contributor Author

The new config option is removed

@ardeois ardeois added minor Increment the minor version when merged patch Increment the patch version when merged and removed patch Increment the patch version when merged labels Nov 27, 2023
@ardeois ardeois enabled auto-merge (squash) November 27, 2023 16:04
auto-merge was automatically disabled November 27, 2023 16:09

Head branch was pushed to by a user without write access

@ardeois ardeois merged commit 32dfe76 into ardeois:main Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants