Closed
Description
TypeScript Version: 3.2.0-dev.201xxxxx
Search Terms:
type narrowing tuple
type inference tuple
Code
const x: [number, number] = [0, 0];
if (x[0] === 0) {
x[0] = -1;
}
Expected behavior:
The code should compile. The above code does compile with typescript@3.0.3
.
Actual behavior:
error TS2322: Type '-1' is not assignable to type '0'.
Playground Link: http://www.typescriptlang.org/play/
Related Issues: