Skip to content

Commit 23c38be

Browse files
committed
fix caching in checkExpressionCached when checkMode is not normal
1 parent 28f667d commit 23c38be

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/compiler/checker.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -33663,11 +33663,11 @@ namespace ts {
3366333663
}
3366433664

3366533665
function checkExpressionCached(node: Expression | QualifiedName, checkMode?: CheckMode): Type {
33666+
if (checkMode && checkMode !== CheckMode.Normal) {
33667+
return checkExpression(node, checkMode);
33668+
}
3366633669
const links = getNodeLinks(node);
3366733670
if (!links.resolvedType) {
33668-
if (checkMode && checkMode !== CheckMode.Normal) {
33669-
return checkExpression(node, checkMode);
33670-
}
3367133671
// When computing a type that we're going to cache, we need to ignore any ongoing control flow
3367233672
// analysis because variables may have transient types in indeterminable states. Moving flowLoopStart
3367333673
// to the top of the stack ensures all transient types are computed from a known point.

tests/baselines/reference/narrowingDestructuring.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function func3<T extends { kind: "a", a: string } | { kind: "b", b: number }>(t:
111111

112112
const { kind, ...r1 } = t;
113113
>kind : "a"
114-
>r1 : { a: string; }
114+
>r1 : Omit<T, "kind">
115115
>t : { kind: "a"; a: string; }
116116

117117
const r2 = (({ kind, ...rest }) => rest)(t);

0 commit comments

Comments
 (0)