TypeScript Version:
nightly (1.9.0-dev.20160217) + strictNullChecks
Code
typeEasing='ease-in'|'ease-out'|'ease-in-out';functiongetEasingFunction(easing: Easing): (val: number)=>number{switch(easing){case'ease-in': returnt=>t*t;case'ease-out': returnt=>t*(2-t);case'ease-in-out': returnt=>t<0.5 ? (2*t*t) : -1+(4-2*t)*t;}// `easing` should be of type `never` here// however the actual type is `'ease-in' | 'ease-out' | 'ease-in-out'`}Expected behavior:
After an exhaustive switch the switched variable should be of type never as per #9163. Conversely, if the switch is not exhaustive and the return type does not accomodate for undefined, an error should be issued.
Actual behavior:
String literal union types are not narrowed thus an error is always issued.
TypeScript Version:
nightly (1.9.0-dev.20160217) + strictNullChecks
Code
Expected behavior:
After an exhaustive
switchthe switched variable should be of typeneveras per #9163. Conversely, if theswitchis not exhaustive and the return type does not accomodate forundefined, an error should be issued.Actual behavior:
String literal union types are not narrowed thus an error is always issued.