Closed
Description
TypeScript Version: 3.2.0-dev.20181004
Search Terms: union tuple array destructuring
Code
type Unioned = [string] | [string, number]
const ex: Unioned = ["hi"] as Unioned
// unexpected: y is typed as string | number, instead of number | undefined
const [x, y] = ex;
Expected behavior:
y
typed as number | undefined
Actual behavior:
y
typed as string | number
Playground Link: Playground
Related Issues: Not really