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
Unify JSX And Normal Call Checking Codepaths (#27627)
* Unify JSX Call Checking Codepaths
* Add tests for fixed issues
* Fix lint, move all error checking into the only-run-once resolveSignature call
* Remove unused (unreachable?) code path
* Consolidate a little more duplicated logic into signature checking
* Fix#19775 a bit more
* Cosmetic changes from CR
// If we're providing completions for an object literal, skip primitive, array-like, or callable types since those shouldn't be implemented by object literals.
Copy file name to clipboardExpand all lines: tests/baselines/reference/checkJsxChildrenProperty14.errors.txt
+10-8Lines changed: 10 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,8 @@
1
-
tests/cases/conformance/jsx/file.tsx(42,11): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'SingleChildProp'.
2
-
Types of property 'children' are incompatible.
3
-
Type 'Element[]' is not assignable to type 'Element'.
4
-
Property 'type' is missing in type 'Element[]'.
1
+
tests/cases/conformance/jsx/file.tsx(42,11): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & SingleChildProp'.
2
+
Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'SingleChildProp'.
3
+
Types of property 'children' are incompatible.
4
+
Type 'Element[]' is not assignable to type 'Element'.
tests/cases/conformance/jsx/file.tsx(14,10): error TS2322: Type '{ a: number; b: string; }' is not assignable to type 'Prop'.
2
-
Property 'children' is missing in type '{ a: number; b: string; }'.
1
+
tests/cases/conformance/jsx/file.tsx(14,10): error TS2322: Type '{ a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
2
+
Type '{ a: number; b: string; }' is not assignable to type 'Prop'.
3
+
Property 'children' is missing in type '{ a: number; b: string; }'.
3
4
tests/cases/conformance/jsx/file.tsx(17,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
4
-
tests/cases/conformance/jsx/file.tsx(31,6): error TS2322: Type '{ children: (Element | ((name: string) => Element))[]; a: number; b: string; }' is not assignable to type 'Prop'.
5
-
Types of property 'children' are incompatible.
6
-
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
7
-
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
8
-
Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
9
-
tests/cases/conformance/jsx/file.tsx(37,6): error TS2322: Type '{ children: (number | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
10
-
Types of property 'children' are incompatible.
11
-
Type '(number | Element)[]' is not assignable to type 'string | Element'.
12
-
Type '(number | Element)[]' is not assignable to type 'Element'.
13
-
Property 'type' is missing in type '(number | Element)[]'.
14
-
tests/cases/conformance/jsx/file.tsx(43,6): error TS2322: Type '{ children: (string | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
15
-
Types of property 'children' are incompatible.
16
-
Type '(string | Element)[]' is not assignable to type 'string | Element'.
17
-
Type '(string | Element)[]' is not assignable to type 'Element'.
18
-
Property 'type' is missing in type '(string | Element)[]'.
19
-
tests/cases/conformance/jsx/file.tsx(49,6): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'Prop'.
20
-
Types of property 'children' are incompatible.
21
-
Type 'Element[]' is not assignable to type 'string | Element'.
22
-
Type 'Element[]' is not assignable to type 'Element'.
23
-
Property 'type' is missing in type 'Element[]'.
5
+
tests/cases/conformance/jsx/file.tsx(31,6): error TS2322: Type '{ children: (Element | ((name: string) => Element))[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
6
+
Type '{ children: (Element | ((name: string) => Element))[]; a: number; b: string; }' is not assignable to type 'Prop'.
7
+
Types of property 'children' are incompatible.
8
+
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
9
+
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
10
+
Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
11
+
tests/cases/conformance/jsx/file.tsx(37,6): error TS2322: Type '{ children: (number | Element)[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
12
+
Type '{ children: (number | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
13
+
Types of property 'children' are incompatible.
14
+
Type '(number | Element)[]' is not assignable to type 'string | Element'.
15
+
Type '(number | Element)[]' is not assignable to type 'Element'.
16
+
Property 'type' is missing in type '(number | Element)[]'.
17
+
tests/cases/conformance/jsx/file.tsx(43,6): error TS2322: Type '{ children: (string | Element)[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
18
+
Type '{ children: (string | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
19
+
Types of property 'children' are incompatible.
20
+
Type '(string | Element)[]' is not assignable to type 'string | Element'.
21
+
Type '(string | Element)[]' is not assignable to type 'Element'.
22
+
Property 'type' is missing in type '(string | Element)[]'.
23
+
tests/cases/conformance/jsx/file.tsx(49,6): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
24
+
Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'Prop'.
25
+
Types of property 'children' are incompatible.
26
+
Type 'Element[]' is not assignable to type 'string | Element'.
27
+
Type 'Element[]' is not assignable to type 'Element'.
!!! error TS2322: Type '{ children: (Element | ((name: string) => Element))[]; a: number; b: string; }' is not assignable to type 'Prop'.
65
-
!!! error TS2322: Types of property 'children' are incompatible.
66
-
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
67
-
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
68
-
!!! error TS2322: Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
70
+
!!! error TS2322: Type '{ children: (Element | ((name: string) => Element))[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
71
+
!!! error TS2322: Type '{ children: (Element | ((name: string) => Element))[]; a: number; b: string; }' is not assignable to type 'Prop'.
72
+
!!! error TS2322: Types of property 'children' are incompatible.
73
+
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
74
+
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
75
+
!!! error TS2322: Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
69
76
<div> My Div </div>
70
77
{(name: string) => <div> My name {name} </div>}
71
78
</Comp>;
72
79
73
80
let k3 =
74
81
<Comp a={10} b="hi">
75
82
~~~~
76
-
!!! error TS2322: Type '{ children: (number | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
77
-
!!! error TS2322: Types of property 'children' are incompatible.
78
-
!!! error TS2322: Type '(number | Element)[]' is not assignable to type 'string | Element'.
79
-
!!! error TS2322: Type '(number | Element)[]' is not assignable to type 'Element'.
80
-
!!! error TS2322: Property 'type' is missing in type '(number | Element)[]'.
83
+
!!! error TS2322: Type '{ children: (number | Element)[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
84
+
!!! error TS2322: Type '{ children: (number | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
85
+
!!! error TS2322: Types of property 'children' are incompatible.
86
+
!!! error TS2322: Type '(number | Element)[]' is not assignable to type 'string | Element'.
87
+
!!! error TS2322: Type '(number | Element)[]' is not assignable to type 'Element'.
88
+
!!! error TS2322: Property 'type' is missing in type '(number | Element)[]'.
81
89
<div> My Div </div>
82
90
{1000000}
83
91
</Comp>;
84
92
85
93
let k4 =
86
94
<Comp a={10} b="hi" >
87
95
~~~~
88
-
!!! error TS2322: Type '{ children: (string | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
89
-
!!! error TS2322: Types of property 'children' are incompatible.
90
-
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'string | Element'.
91
-
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element'.
92
-
!!! error TS2322: Property 'type' is missing in type '(string | Element)[]'.
96
+
!!! error TS2322: Type '{ children: (string | Element)[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
97
+
!!! error TS2322: Type '{ children: (string | Element)[]; a: number; b: string; }' is not assignable to type 'Prop'.
98
+
!!! error TS2322: Types of property 'children' are incompatible.
99
+
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'string | Element'.
100
+
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element'.
101
+
!!! error TS2322: Property 'type' is missing in type '(string | Element)[]'.
93
102
<div> My Div </div>
94
103
hi hi hi!
95
104
</Comp>;
96
105
97
106
let k5 =
98
107
<Comp a={10} b="hi" >
99
108
~~~~
100
-
!!! error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'Prop'.
101
-
!!! error TS2322: Types of property 'children' are incompatible.
102
-
!!! error TS2322: Type 'Element[]' is not assignable to type 'string | Element'.
103
-
!!! error TS2322: Type 'Element[]' is not assignable to type 'Element'.
104
-
!!! error TS2322: Property 'type' is missing in type 'Element[]'.
109
+
!!! error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & Prop'.
110
+
!!! error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'Prop'.
111
+
!!! error TS2322: Types of property 'children' are incompatible.
112
+
!!! error TS2322: Type 'Element[]' is not assignable to type 'string | Element'.
113
+
!!! error TS2322: Type 'Element[]' is not assignable to type 'Element'.
114
+
!!! error TS2322: Property 'type' is missing in type 'Element[]'.
0 commit comments