We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TupleToUnion
It provides support for TupleToUnion.
There are some situations that need to change tuple to union type. It is more detailed example for API Response that is used TupleToUnion.
type ApiResponse = [number, string, boolean, { key: string }]; type AllowedValues = TupleToUnion<ApiResponse>; // number | string | boolean | { key: string } function handler (response: AllowedValues) { if (typeof response === 'number') { // } else if (typeof response === 'string) { // } else if (typeof response === 'boolean) { // } else { // } }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
It provides support for
TupleToUnion
.There are some situations that need to change tuple to union type.
It is more detailed example for API Response that is used
TupleToUnion
.The text was updated successfully, but these errors were encountered: