Skip to content

Commit 1c00498

Browse files
committed
Avoid caching too to avoid resolved type to carry over from unmatched overload
1 parent 4ea8ec4 commit 1c00498

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28781,7 +28781,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2878128781
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false);
2878228782
attributesTable = createSymbolTable();
2878328783
}
28784-
const exprType = getReducedType(checkExpressionCached(attributeDecl.expression));
28784+
const exprType = getReducedType(checkExpression(attributeDecl.expression));
2878528785
if (isTypeAny(exprType)) {
2878628786
hasSpreadAnyType = true;
2878728787
}

tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,43): err
1717
Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'.
1818
Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
1919
Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error.
20-
Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
20+
Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
2121
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
2222
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,12): error TS2769: No overload matches this call.
2323
Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error.
@@ -84,7 +84,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,44): err
8484
!!! error TS2769: Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'.
8585
!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
8686
!!! error TS2769: Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error.
87-
!!! error TS2769: Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
87+
!!! error TS2769: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
8888
!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
8989
const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact"
9090
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)