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
{{ message }}
Repository navigation
Commit 2facf71
Browse filesBrowse the repository at this point in the historyBrowse files
Discard results computed from a binding pattern's own elements
While the type implied by a binding pattern is computed as the
contextual type of its initializer, references to the pattern's
elements from the elements' defaults are any. The calls and types
computed from them were cached anyway, so asking for the contextual
type of the initializer first left `extra` in
const { kind, payload, extra = kind === "a" ? ... : ... } = u;
as any rather than unknown. TypeScript behaves the same way.
Track the patterns as resolutions in progress rather than a separate
stack, so that a reference returning any marks the computation
circular and what was cached from it is discarded.
(seen in check order fuzzing)
Copy file name to clipboardExpand all lines: tsc/testdata/baselines/reference/compiler/dependentDestructuringBindingElementInitializer(checkorder=typesfirst).types
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,8 @@ const {
25
25
>payload : string | number
26
26
27
27
extra = kind === "a" ? payload.toFixed() : payload.toUpperCase(),
28
-
>extra : any
29
-
>kind === "a" ? payload.toFixed() : payload.toUpperCase() : any
28
+
>extra : unknown
29
+
>kind === "a" ? payload.toFixed() : payload.toUpperCase() : string
0 commit comments