Skip to content

Commit b7c54f3

Browse files
author
Kanchalai Tanglertsampan
committed
Update tests and baselines
1 parent e829fa0 commit b7c54f3

9 files changed

+125
-175
lines changed

tests/baselines/reference/tsxAttributeResolution5.errors.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
tests/cases/conformance/jsx/file.tsx(17,16): error TS2698: Spread types may only be created from object types.
2-
tests/cases/conformance/jsx/file.tsx(21,16): error TS2698: Spread types may only be created from object types.
3-
tests/cases/conformance/jsx/file.tsx(25,16): error TS2698: Spread types may only be created from object types.
1+
tests/cases/conformance/jsx/file.tsx(21,16): error TS2322: Type '{ x: number; }' is not assignable to type 'Attribs1'.
2+
Types of property 'x' are incompatible.
3+
Type 'number' is not assignable to type 'string'.
4+
tests/cases/conformance/jsx/file.tsx(25,16): error TS2322: Type '{ y: string; }' is not assignable to type 'Attribs1'.
5+
Property 'x' is missing in type '{ y: string; }'.
46
tests/cases/conformance/jsx/file.tsx(29,8): error TS2322: Type '{}' is not assignable to type 'Attribs1'.
57
Property 'x' is missing in type '{}'.
68

79

8-
==== tests/cases/conformance/jsx/file.tsx (4 errors) ====
10+
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
911
declare module JSX {
1012
interface Element { }
1113
interface IntrinsicElements {
@@ -23,20 +25,21 @@ tests/cases/conformance/jsx/file.tsx(29,8): error TS2322: Type '{}' is not assig
2325

2426
function make1<T extends {x: string}> (obj: T) {
2527
return <test1 {...obj} />; // OK
26-
~~~~~~~~
27-
!!! error TS2698: Spread types may only be created from object types.
2828
}
2929

3030
function make2<T extends {x: number}> (obj: T) {
3131
return <test1 {...obj} />; // Error (x is number, not string)
3232
~~~~~~~~
33-
!!! error TS2698: Spread types may only be created from object types.
33+
!!! error TS2322: Type '{ x: number; }' is not assignable to type 'Attribs1'.
34+
!!! error TS2322: Types of property 'x' are incompatible.
35+
!!! error TS2322: Type 'number' is not assignable to type 'string'.
3436
}
3537

3638
function make3<T extends {y: string}> (obj: T) {
3739
return <test1 {...obj} />; // Error, missing x
3840
~~~~~~~~
39-
!!! error TS2698: Spread types may only be created from object types.
41+
!!! error TS2322: Type '{ y: string; }' is not assignable to type 'Attribs1'.
42+
!!! error TS2322: Property 'x' is missing in type '{ y: string; }'.
4043
}
4144

4245

tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
tests/cases/conformance/jsx/file.tsx(8,34): error TS2698: Spread types may only be created from object types.
2-
tests/cases/conformance/jsx/file.tsx(13,34): error TS2698: Spread types may only be created from object types.
1+
tests/cases/conformance/jsx/file.tsx(8,34): error TS2322: Type '{ ignore-prop: 10; prop: number; }' is not assignable to type 'IntrinsicAttributes & { prop: number; "ignore-prop": string; }'.
2+
Type '{ ignore-prop: 10; prop: number; }' is not assignable to type '{ prop: number; "ignore-prop": string; }'.
3+
Types of property '"ignore-prop"' are incompatible.
4+
Type '10' is not assignable to type 'string'.
5+
tests/cases/conformance/jsx/file.tsx(13,34): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & { prop: {}; "ignore-prop": string; }'.
6+
Type '{}' is not assignable to type '{ prop: {}; "ignore-prop": string; }'.
7+
Property 'prop' is missing in type '{}'.
38
tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '{ func: (a: number, b: string) => void; }' is not assignable to type 'IntrinsicAttributes & { func: (arg: number) => void; }'.
49
Type '{ func: (a: number, b: string) => void; }' is not assignable to type '{ func: (arg: number) => void; }'.
510
Types of property 'func' are incompatible.
@@ -19,15 +24,20 @@ tests/cases/conformance/jsx/file.tsx(31,10): error TS2453: The type argument for
1924
// Error
2025
function Bar<T extends {prop: number}>(arg: T) {
2126
let a1 = <ComponentSpecific1 {...arg} ignore-prop={10} />;
22-
~~~~~~~~
23-
!!! error TS2698: Spread types may only be created from object types.
27+
~~~~~~~~~~~~~~~~~~~~~~~~~
28+
!!! error TS2322: Type '{ ignore-prop: 10; prop: number; }' is not assignable to type 'IntrinsicAttributes & { prop: number; "ignore-prop": string; }'.
29+
!!! error TS2322: Type '{ ignore-prop: 10; prop: number; }' is not assignable to type '{ prop: number; "ignore-prop": string; }'.
30+
!!! error TS2322: Types of property '"ignore-prop"' are incompatible.
31+
!!! error TS2322: Type '10' is not assignable to type 'string'.
2432
}
2533

2634
// Error
2735
function Baz<T>(arg: T) {
2836
let a0 = <ComponentSpecific1 {...arg} />
2937
~~~~~~~~
30-
!!! error TS2698: Spread types may only be created from object types.
38+
!!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & { prop: {}; "ignore-prop": string; }'.
39+
!!! error TS2322: Type '{}' is not assignable to type '{ prop: {}; "ignore-prop": string; }'.
40+
!!! error TS2322: Property 'prop' is missing in type '{}'.
3141
}
3242

3343
declare function Link<U>(l: {func: (arg: U)=>void}): JSX.Element;

tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments3.errors.txt

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 79 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,127 @@
11
=== tests/cases/conformance/jsx/file.tsx ===
2-
32
import React = require('react')
43
>React : Symbol(React, Decl(file.tsx, 0, 0))
54

65
declare function OverloadComponent<U>(): JSX.Element;
7-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
8-
>U : Symbol(U, Decl(file.tsx, 3, 35))
6+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
7+
>U : Symbol(U, Decl(file.tsx, 2, 35))
98
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
109
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
1110

1211
declare function OverloadComponent<U>(attr: {b: U, a?: string, "ignore-prop": boolean}): JSX.Element;
13-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
14-
>U : Symbol(U, Decl(file.tsx, 4, 35))
15-
>attr : Symbol(attr, Decl(file.tsx, 4, 38))
16-
>b : Symbol(b, Decl(file.tsx, 4, 45))
17-
>U : Symbol(U, Decl(file.tsx, 4, 35))
18-
>a : Symbol(a, Decl(file.tsx, 4, 50))
12+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
13+
>U : Symbol(U, Decl(file.tsx, 3, 35))
14+
>attr : Symbol(attr, Decl(file.tsx, 3, 38))
15+
>b : Symbol(b, Decl(file.tsx, 3, 45))
16+
>U : Symbol(U, Decl(file.tsx, 3, 35))
17+
>a : Symbol(a, Decl(file.tsx, 3, 50))
1918
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
2019
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
2120

2221
declare function OverloadComponent<T, U>(attr: {b: U, a: T}): JSX.Element;
23-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
24-
>T : Symbol(T, Decl(file.tsx, 5, 35))
25-
>U : Symbol(U, Decl(file.tsx, 5, 37))
26-
>attr : Symbol(attr, Decl(file.tsx, 5, 41))
27-
>b : Symbol(b, Decl(file.tsx, 5, 48))
28-
>U : Symbol(U, Decl(file.tsx, 5, 37))
29-
>a : Symbol(a, Decl(file.tsx, 5, 53))
30-
>T : Symbol(T, Decl(file.tsx, 5, 35))
22+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
23+
>T : Symbol(T, Decl(file.tsx, 4, 35))
24+
>U : Symbol(U, Decl(file.tsx, 4, 37))
25+
>attr : Symbol(attr, Decl(file.tsx, 4, 41))
26+
>b : Symbol(b, Decl(file.tsx, 4, 48))
27+
>U : Symbol(U, Decl(file.tsx, 4, 37))
28+
>a : Symbol(a, Decl(file.tsx, 4, 53))
29+
>T : Symbol(T, Decl(file.tsx, 4, 35))
3130
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
3231
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
3332

3433
// OK
3534
function Baz<T extends {b: number}, U extends {a: boolean, b:string}>(arg1: T, arg2: U) {
36-
>Baz : Symbol(Baz, Decl(file.tsx, 5, 74))
37-
>T : Symbol(T, Decl(file.tsx, 8, 13))
38-
>b : Symbol(b, Decl(file.tsx, 8, 24))
39-
>U : Symbol(U, Decl(file.tsx, 8, 35))
40-
>a : Symbol(a, Decl(file.tsx, 8, 47))
41-
>b : Symbol(b, Decl(file.tsx, 8, 58))
42-
>arg1 : Symbol(arg1, Decl(file.tsx, 8, 70))
43-
>T : Symbol(T, Decl(file.tsx, 8, 13))
44-
>arg2 : Symbol(arg2, Decl(file.tsx, 8, 78))
45-
>U : Symbol(U, Decl(file.tsx, 8, 35))
35+
>Baz : Symbol(Baz, Decl(file.tsx, 4, 74))
36+
>T : Symbol(T, Decl(file.tsx, 7, 13))
37+
>b : Symbol(b, Decl(file.tsx, 7, 24))
38+
>U : Symbol(U, Decl(file.tsx, 7, 35))
39+
>a : Symbol(a, Decl(file.tsx, 7, 47))
40+
>b : Symbol(b, Decl(file.tsx, 7, 58))
41+
>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70))
42+
>T : Symbol(T, Decl(file.tsx, 7, 13))
43+
>arg2 : Symbol(arg2, Decl(file.tsx, 7, 78))
44+
>U : Symbol(U, Decl(file.tsx, 7, 35))
4645

4746
let a0 = <OverloadComponent {...arg1} a="hello" ignore-prop />;
48-
>a0 : Symbol(a0, Decl(file.tsx, 9, 7))
49-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
50-
>arg1 : Symbol(arg1, Decl(file.tsx, 8, 70))
51-
>a : Symbol(a, Decl(file.tsx, 9, 41))
52-
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 9, 51))
47+
>a0 : Symbol(a0, Decl(file.tsx, 8, 7))
48+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
49+
>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70))
50+
>a : Symbol(a, Decl(file.tsx, 8, 41))
51+
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 8, 51))
5352

5453
let a1 = <OverloadComponent {...arg2} ignore-pro="hello world" />;
55-
>a1 : Symbol(a1, Decl(file.tsx, 10, 7))
56-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
57-
>arg2 : Symbol(arg2, Decl(file.tsx, 8, 78))
58-
>ignore-pro : Symbol(ignore-pro, Decl(file.tsx, 10, 41))
54+
>a1 : Symbol(a1, Decl(file.tsx, 9, 7))
55+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
56+
>arg2 : Symbol(arg2, Decl(file.tsx, 7, 78))
57+
>ignore-pro : Symbol(ignore-pro, Decl(file.tsx, 9, 41))
5958

6059
let a2 = <OverloadComponent {...arg2} />;
61-
>a2 : Symbol(a2, Decl(file.tsx, 11, 7))
62-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
63-
>arg2 : Symbol(arg2, Decl(file.tsx, 8, 78))
60+
>a2 : Symbol(a2, Decl(file.tsx, 10, 7))
61+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
62+
>arg2 : Symbol(arg2, Decl(file.tsx, 7, 78))
6463

6564
let a3 = <OverloadComponent {...arg1} ignore-prop />;
66-
>a3 : Symbol(a3, Decl(file.tsx, 12, 7))
67-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
68-
>arg1 : Symbol(arg1, Decl(file.tsx, 8, 70))
69-
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 12, 41))
65+
>a3 : Symbol(a3, Decl(file.tsx, 11, 7))
66+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
67+
>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70))
68+
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 11, 41))
7069

7170
let a4 = <OverloadComponent />;
72-
>a4 : Symbol(a4, Decl(file.tsx, 13, 7))
73-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
71+
>a4 : Symbol(a4, Decl(file.tsx, 12, 7))
72+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
7473

7574
let a5 = <OverloadComponent {...arg2} ignore-prop="hello" {...arg1} />;
76-
>a5 : Symbol(a5, Decl(file.tsx, 14, 7))
77-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
78-
>arg2 : Symbol(arg2, Decl(file.tsx, 8, 78))
79-
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 14, 41))
80-
>arg1 : Symbol(arg1, Decl(file.tsx, 8, 70))
75+
>a5 : Symbol(a5, Decl(file.tsx, 13, 7))
76+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
77+
>arg2 : Symbol(arg2, Decl(file.tsx, 7, 78))
78+
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 13, 41))
79+
>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70))
8180

8281
let a6 = <OverloadComponent {...arg2} ignore-prop {...arg1} />;
83-
>a6 : Symbol(a6, Decl(file.tsx, 15, 7))
84-
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 1, 31), Decl(file.tsx, 3, 53), Decl(file.tsx, 4, 101))
85-
>arg2 : Symbol(arg2, Decl(file.tsx, 8, 78))
86-
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 15, 41))
87-
>arg1 : Symbol(arg1, Decl(file.tsx, 8, 70))
82+
>a6 : Symbol(a6, Decl(file.tsx, 14, 7))
83+
>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 101))
84+
>arg2 : Symbol(arg2, Decl(file.tsx, 7, 78))
85+
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 14, 41))
86+
>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70))
8887
}
8988

9089
declare function Link<U>(l: {func: (arg: U)=>void}): JSX.Element;
91-
>Link : Symbol(Link, Decl(file.tsx, 16, 1), Decl(file.tsx, 18, 65))
92-
>U : Symbol(U, Decl(file.tsx, 18, 22))
93-
>l : Symbol(l, Decl(file.tsx, 18, 25))
94-
>func : Symbol(func, Decl(file.tsx, 18, 29))
95-
>arg : Symbol(arg, Decl(file.tsx, 18, 36))
96-
>U : Symbol(U, Decl(file.tsx, 18, 22))
90+
>Link : Symbol(Link, Decl(file.tsx, 15, 1), Decl(file.tsx, 17, 65))
91+
>U : Symbol(U, Decl(file.tsx, 17, 22))
92+
>l : Symbol(l, Decl(file.tsx, 17, 25))
93+
>func : Symbol(func, Decl(file.tsx, 17, 29))
94+
>arg : Symbol(arg, Decl(file.tsx, 17, 36))
95+
>U : Symbol(U, Decl(file.tsx, 17, 22))
9796
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
9897
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
9998

10099
declare function Link<U>(l: {func: (arg1:U, arg2: string)=>void}): JSX.Element;
101-
>Link : Symbol(Link, Decl(file.tsx, 16, 1), Decl(file.tsx, 18, 65))
102-
>U : Symbol(U, Decl(file.tsx, 19, 22))
103-
>l : Symbol(l, Decl(file.tsx, 19, 25))
104-
>func : Symbol(func, Decl(file.tsx, 19, 29))
105-
>arg1 : Symbol(arg1, Decl(file.tsx, 19, 36))
106-
>U : Symbol(U, Decl(file.tsx, 19, 22))
107-
>arg2 : Symbol(arg2, Decl(file.tsx, 19, 43))
100+
>Link : Symbol(Link, Decl(file.tsx, 15, 1), Decl(file.tsx, 17, 65))
101+
>U : Symbol(U, Decl(file.tsx, 18, 22))
102+
>l : Symbol(l, Decl(file.tsx, 18, 25))
103+
>func : Symbol(func, Decl(file.tsx, 18, 29))
104+
>arg1 : Symbol(arg1, Decl(file.tsx, 18, 36))
105+
>U : Symbol(U, Decl(file.tsx, 18, 22))
106+
>arg2 : Symbol(arg2, Decl(file.tsx, 18, 43))
108107
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
109108
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
110109

111110
function createLink(func: (a: number)=>void) {
112-
>createLink : Symbol(createLink, Decl(file.tsx, 19, 79))
113-
>func : Symbol(func, Decl(file.tsx, 20, 20))
114-
>a : Symbol(a, Decl(file.tsx, 20, 27))
111+
>createLink : Symbol(createLink, Decl(file.tsx, 18, 79))
112+
>func : Symbol(func, Decl(file.tsx, 19, 20))
113+
>a : Symbol(a, Decl(file.tsx, 19, 27))
115114

116115
let o = <Link func={func} />
117-
>o : Symbol(o, Decl(file.tsx, 21, 7))
118-
>Link : Symbol(Link, Decl(file.tsx, 16, 1), Decl(file.tsx, 18, 65))
119-
>func : Symbol(func, Decl(file.tsx, 21, 17))
120-
>func : Symbol(func, Decl(file.tsx, 20, 20))
116+
>o : Symbol(o, Decl(file.tsx, 20, 7))
117+
>Link : Symbol(Link, Decl(file.tsx, 15, 1), Decl(file.tsx, 17, 65))
118+
>func : Symbol(func, Decl(file.tsx, 20, 17))
119+
>func : Symbol(func, Decl(file.tsx, 19, 20))
121120

122121
let o1 = <Link func={(a:number, b:string)=>{}} />;
123-
>o1 : Symbol(o1, Decl(file.tsx, 22, 7))
124-
>Link : Symbol(Link, Decl(file.tsx, 16, 1), Decl(file.tsx, 18, 65))
125-
>func : Symbol(func, Decl(file.tsx, 22, 18))
126-
>a : Symbol(a, Decl(file.tsx, 22, 26))
127-
>b : Symbol(b, Decl(file.tsx, 22, 35))
122+
>o1 : Symbol(o1, Decl(file.tsx, 21, 7))
123+
>Link : Symbol(Link, Decl(file.tsx, 15, 1), Decl(file.tsx, 17, 65))
124+
>func : Symbol(func, Decl(file.tsx, 21, 18))
125+
>a : Symbol(a, Decl(file.tsx, 21, 26))
126+
>b : Symbol(b, Decl(file.tsx, 21, 35))
128127
}

tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments3.types

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
=== tests/cases/conformance/jsx/file.tsx ===
2-
32
import React = require('react')
43
>React : typeof React
54

@@ -131,8 +130,8 @@ function createLink(func: (a: number)=>void) {
131130
>o1 : JSX.Element
132131
><Link func={(a:number, b:string)=>{}} /> : JSX.Element
133132
>Link : { <U>(l: { func: (arg: U) => void; }): JSX.Element; <U>(l: { func: (arg1: U, arg2: string) => void; }): JSX.Element; }
134-
>func : (a: number, b: string) => void
135-
>(a:number, b:string)=>{} : (a: number, b: string) => void
133+
>func : (a: number, b: string) => any
134+
>(a:number, b:string)=>{} : (a: number, b: string) => any
136135
>a : number
137136
>b : string
138137
}

0 commit comments

Comments
 (0)