You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Pretty sure this is a design limitation of the way that Typescript checks types. It uses a simple strategy augmented by contextual typing, but that is simple too, and happens at the same time during checking every time.
Still, it might be possible to tweak the order of checking in destructuring declarations to avoid the error.
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in the issue body running against the nightly TypeScript.
TypeScript Version: 3.6.2
Search Terms: circular reference, array destructuring initializer
Code
Expected behavior: Should compile. Both
a
andb
are of typenumber
.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
Related Issues: #32950, #33191
The text was updated successfully, but these errors were encountered: