TypeScript Version: 2.7.1
Search Terms: infer, compare, equals
Code
typeT=[number]|[number,number];// now t.length has type 1|2lett: T;if(t!.length===0){// compile error: Operator '===' cannot be applied to types '1' and '0'}if(t!.length>100){// no compile error}if(t!.length===1-1){// no compile error}Expected behavior:
No compile errors on any of these. It's plain inconsistent and not useful.
Actual behavior:
Compile error on t === 0 but not on other comparisons
Playground Link:
See above
Related Issues:
TypeScript Version: 2.7.1
Search Terms: infer, compare, equals
Code
Expected behavior:
No compile errors on any of these. It's plain inconsistent and not useful.
Actual behavior:
Compile error on
t === 0but not on other comparisonsPlayground Link:
See above
Related Issues: