Closed iamdustan closed 8 years ago
No reaction to this so far?
I beleive this introduces some serious flaws in type checking, like:
const x: [string] = [];
const [y] = x;
// calling concat on undefined, and it is allowed!
const z = y.concat(''); // Uncaught TypeError: Cannot read property 'concat' of undefined
For example Typescript is strict with tuple:
const x: [string] = [];
// Typescript error: Type 'undefined[]' is not assignable to type '[string]'. Property '0' is missing in type 'undefined[]'.
When declaring a tuple type with expected types at each index, Flow doesn’t error on undefined slots. Doing the wrong type in a given index does error as expected.
Example repro at: https://gist.github.com/iamdustan/0fd4559b1339c0cb8759