Skip to content

Conversation

@duncanbeevers
Copy link
Collaborator

🐸 const & readonly string arrays can't be used in schemas

const statuses = ['pending', 'downloading', 'processing', 'complete'] as const;
Types.enum(statuses);
// Argument of type 'readonly ["pending", "downloading", "processing", "complete"]'
// is not assignable to parameter of type 'unknown[]'.

🍒 Easy fix

Since schemas aren't mutated, Types.enum can accept readonly enums

Copy link
Collaborator

@avaly avaly left a comment

Choose a reason for hiding this comment

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

Fix the new lint warnings.

Have you tested this change in our private repo?

@duncanbeevers
Copy link
Collaborator Author

Fix the new lint warnings.

👍

Have you tested this change in our private repo?

Yes.

@duncanbeevers duncanbeevers requested a review from avaly July 11, 2023 06:11
@avaly avaly merged commit 194e505 into plexinc:main Jul 11, 2023
@duncanbeevers duncanbeevers deleted the feat/readonly-enum branch July 11, 2023 14:29
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.

2 participants