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
Copy file name to clipboardExpand all lines: src/compiler/checker.ts
+9-17Lines changed: 9 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -7013,7 +7013,7 @@ namespace ts {
7013
7013
return true;
7014
7014
}
7015
7015
else if (getPropertyOfType(type, name) || (isComparingJsxAttributes && !isUnhyphenatedJsxName(name))) {
7016
-
// For JSXAttributes, if the attribute has hyphenated name considered the attribute to be known
7016
+
// For JSXAttributes, if the attribute has a hyphenated name, consider that the attribute to be known.
7017
7017
return true;
7018
7018
}
7019
7019
}
@@ -10527,27 +10527,19 @@ namespace ts {
10527
10527
10528
10528
function getContextualTypeForJsxAttribute(attribute: JsxAttribute | JsxSpreadAttribute) {
10529
10529
// When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give JSXAttributes a contextual type
10530
-
// which is a type of the parameter of the signature we are trying out. This is not the case if it is a statefull Jsx (i.e ReactComponenet class)
10530
+
// which is a type of the parameter of the signature we are trying out. This is not the case if it is a stateful JSX (i.e ReactComponenet class)
10531
10531
// So if that is the case, just return the type of the JsxAttribute in such contextual type with out going into resolving of the JsxOpeningLikeElement again
10532
-
if ((<JsxAttributes>attribute.parent).contextualType) {
Copy file name to clipboardExpand all lines: tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,24): error TS2322: Type '{ extra: true; onClick: (k: any) => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
1
+
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,24): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
2
2
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
3
3
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,24): error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
4
4
Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'.
5
5
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,24): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
6
6
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
7
7
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(31,24): error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
8
8
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
9
-
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(34,25): error TS2322: Type '{ extra: true; onClick: (k: any) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'.
9
+
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(34,25): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'.
10
10
Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
11
11
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(37,25): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
12
12
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
Copy file name to clipboardExpand all lines: tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ tests/cases/conformance/jsx/file.tsx(50,24): error TS2322: Type '{ to: string; o
4
4
Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'.
5
5
tests/cases/conformance/jsx/file.tsx(51,24): error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
6
6
Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'.
7
-
tests/cases/conformance/jsx/file.tsx(52,24): error TS2322: Type '{ onClick: (k: any) => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
7
+
tests/cases/conformance/jsx/file.tsx(52,24): error TS2322: Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
8
8
Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'.
9
9
tests/cases/conformance/jsx/file.tsx(54,24): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
10
10
Type '{}' is not assignable to type 'HyphenProps'.
@@ -84,7 +84,7 @@ tests/cases/conformance/jsx/file.tsx(57,24): error TS2322: Type '{ data-format:
84
84
!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'.
0 commit comments