Closed
Description
TypeScript Version: 3.6.2
Search Terms: circular reference, array destructuring initializer
Code
// @strict
declare const x: number | undefined;
const [a, b = a] = [10, x];
Expected behavior: Should compile. Both a
and b
are of type number
.
Actual behavior:
Error: 'a' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
Playground Link: playground