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

Correctly infer string enums on const arrays #12870

Merged
merged 3 commits into from Jan 6, 2023

Conversation

JavaScriptBach
Copy link
Contributor

@JavaScriptBach JavaScriptBach commented Jan 3, 2023

Summary

Fixes #12869

Not a TypeScript expert, but I followed the example in #12463 and added a test case demonstrating this change works. I think what is happening here is that a readonly array cannot extend a regular array, so our types here need to use ReadonlyArray to handle both const and regular arrays.

Examples

@JavaScriptBach JavaScriptBach marked this pull request as ready for review January 3, 2023 23:31
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@vkarpov15 vkarpov15 added this to the 6.8.3 milestone Jan 6, 2023
@vkarpov15 vkarpov15 merged commit fe9bc23 into Automattic:master Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InferSchemaType: string enums not being inferred for const arrays
2 participants