-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
unreachable code detection for switch cases out of range of string literal types #6149
Comments
This is somewhat surprising -- we should be issuing an error that |
We could contextually type |
In this case |
Check out #6196 which will make this do exactly what you want. |
I will, thanks a lot! |
it works!
gives
looking to see it merged in |
1.8 isn't complaining about a declared type of the following: // in a node_module with a typings field
export declare type OrderStatus = 'CREATED' | 'WAITING' | 'PAID' | 'NOT_PAID' | 'REVERTED'; scope['status'] = (item: IModelTransaction) => {
switch (item.status) { // where > item.status: OrderStatus;
case 'CRATED': // not complaining and compiling
return 'Criado';
case 'PAID':
return 'Pago';
case 'WAITING':
return 'Aguardando';
case 'REVERTED':
return 'Estornado';
case 'NOT_PAID':
return 'Não pago';
}
}; |
Yes, the issue won't be fixed in 1.8 |
@DanielRosenwasser are the labels on this issue correct? |
This issue is fixed with #9407. |
The text was updated successfully, but these errors were encountered: