Skip to content

Commit 2c15eab

Browse files
author
Kanchalai Tanglertsampan
committed
Update conformance tests baselines
1 parent a0b7c2e commit 2c15eab

File tree

147 files changed

+5588
-421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+5588
-421
lines changed

tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(16,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
2-
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(17,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
1+
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(16,15): error TS2322: Type '{ foo: "f"; }' is not assignable to type '{ foo: "A" | "B" | "C"; }'.
2+
Types of property 'foo' are incompatible.
3+
Type '"f"' is not assignable to type '"A" | "B" | "C"'.
4+
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(17,15): error TS2322: Type '{ foo: "f"; }' is not assignable to type '{ foo: "A" | "B" | "C"; }'.
5+
Types of property 'foo' are incompatible.
6+
Type '"f"' is not assignable to type '"A" | "B" | "C"'.
37

48

59
==== tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx (2 errors) ====
@@ -20,7 +24,11 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStr
2024

2125
<FooComponent foo={"f"} />;
2226
~~~~~~~~~
23-
!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
27+
!!! error TS2322: Type '{ foo: "f"; }' is not assignable to type '{ foo: "A" | "B" | "C"; }'.
28+
!!! error TS2322: Types of property 'foo' are incompatible.
29+
!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
2430
<FooComponent foo="f" />;
2531
~~~~~~~
26-
!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
32+
!!! error TS2322: Type '{ foo: "f"; }' is not assignable to type '{ foo: "A" | "B" | "C"; }'.
33+
!!! error TS2322: Types of property 'foo' are incompatible.
34+
!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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'.
2+
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
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+
Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'.
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+
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
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+
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'.
10+
Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
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+
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
13+
14+
15+
==== tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx (6 errors) ====
16+
17+
import React = require('react')
18+
19+
export interface ClickableProps {
20+
children?: string;
21+
className?: string;
22+
}
23+
24+
export interface ButtonProps extends ClickableProps {
25+
onClick: (k: "left" | "right") => void;
26+
}
27+
28+
export interface LinkProps extends ClickableProps {
29+
goTo: "home" | "contact";
30+
}
31+
32+
export function MainButton(buttonProps: ButtonProps): JSX.Element;
33+
export function MainButton(linkProps: LinkProps): JSX.Element;
34+
export function MainButton(props: ButtonProps | LinkProps): JSX.Element {
35+
const linkProps = props as LinkProps;
36+
if(linkProps.goTo) {
37+
return this._buildMainLink(props);
38+
}
39+
40+
return this._buildMainButton(props);
41+
}
42+
43+
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
!!! error TS2322: Type '{ extra: true; onClick: (k: any) => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
46+
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
47+
const b2 = <MainButton onClick={(k)=>{console.log(k)}} extra />; // k has type "left" | "right"
48+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49+
!!! error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
50+
!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'.
51+
const b3 = <MainButton {...{goTo:"home"}} extra />; // goTo has type"home" | "contact"
52+
~~~~~~~~~~~~~~~~~~~~~~~~
53+
!!! error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
54+
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
55+
const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact"
56+
~~~~~~~~~~~~~~~~~
57+
!!! error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
58+
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
59+
60+
export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined }
61+
const c1 = <NoOverload {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
62+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63+
!!! error TS2322: Type '{ extra: true; onClick: (k: any) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'.
64+
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
65+
66+
export function NoOverload1(linkProps: LinkProps): JSX.Element { return undefined }
67+
const d1 = <NoOverload1 {...{goTo:"home"}} extra />; // goTo has type "home" | "contact"
68+
~~~~~~~~~~~~~~~~~~~~~~~~
69+
!!! error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
70+
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
71+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//// [file.tsx]
2+
3+
import React = require('react')
4+
5+
export interface ClickableProps {
6+
children?: string;
7+
className?: string;
8+
}
9+
10+
export interface ButtonProps extends ClickableProps {
11+
onClick: (k: "left" | "right") => void;
12+
}
13+
14+
export interface LinkProps extends ClickableProps {
15+
goTo: "home" | "contact";
16+
}
17+
18+
export function MainButton(buttonProps: ButtonProps): JSX.Element;
19+
export function MainButton(linkProps: LinkProps): JSX.Element;
20+
export function MainButton(props: ButtonProps | LinkProps): JSX.Element {
21+
const linkProps = props as LinkProps;
22+
if(linkProps.goTo) {
23+
return this._buildMainLink(props);
24+
}
25+
26+
return this._buildMainButton(props);
27+
}
28+
29+
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
30+
const b2 = <MainButton onClick={(k)=>{console.log(k)}} extra />; // k has type "left" | "right"
31+
const b3 = <MainButton {...{goTo:"home"}} extra />; // goTo has type"home" | "contact"
32+
const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact"
33+
34+
export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined }
35+
const c1 = <NoOverload {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
36+
37+
export function NoOverload1(linkProps: LinkProps): JSX.Element { return undefined }
38+
const d1 = <NoOverload1 {...{goTo:"home"}} extra />; // goTo has type "home" | "contact"
39+
40+
41+
//// [file.jsx]
42+
define(["require", "exports", "react"], function (require, exports, React) {
43+
"use strict";
44+
function MainButton(props) {
45+
var linkProps = props;
46+
if (linkProps.goTo) {
47+
return this._buildMainLink(props);
48+
}
49+
return this._buildMainButton(props);
50+
}
51+
exports.MainButton = MainButton;
52+
var b0 = <MainButton {...{ onClick: function (k) { console.log(k); } }} extra/>; // k has type any
53+
var b2 = <MainButton onClick={function (k) { console.log(k); }} extra/>; // k has type "left" | "right"
54+
var b3 = <MainButton {...{ goTo: "home" }} extra/>; // goTo has type"home" | "contact"
55+
var b4 = <MainButton goTo="home" extra/>; // goTo has type "home" | "contact"
56+
function NoOverload(buttonProps) { return undefined; }
57+
exports.NoOverload = NoOverload;
58+
var c1 = <NoOverload {...{ onClick: function (k) { console.log(k); } }} extra/>; // k has type any
59+
function NoOverload1(linkProps) { return undefined; }
60+
exports.NoOverload1 = NoOverload1;
61+
var d1 = <NoOverload1 {...{ goTo: "home" }} extra/>; // goTo has type "home" | "contact"
62+
});

tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ declare var React: any;
55

66
<foo data/>
77
>foo : Symbol(unknown)
8-
>data : Symbol(unknown)
8+
>data : Symbol(data, Decl(jsxEmitAttributeWithPreserve.tsx, 2, 4))
99

tests/baselines/reference/jsxEmitAttributeWithPreserve.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ declare var React: any;
66
<foo data/>
77
><foo data/> : any
88
>foo : any
9-
>data : any
9+
>data : true
1010

tests/baselines/reference/jsxEmitWithAttributes.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ class A {
101101
return [
102102
<meta content="helloworld"></meta>,
103103
>meta : Symbol(unknown)
104-
>content : Symbol(unknown)
104+
>content : Symbol(content, Decl(test.tsx, 11, 8))
105105
>meta : Symbol(unknown)
106106

107107
<meta content={c.a!.b}></meta>
108108
>meta : Symbol(unknown)
109-
>content : Symbol(unknown)
109+
>content : Symbol(content, Decl(test.tsx, 12, 8))
110110
>c.a!.b : Symbol(b, Decl(test.tsx, 3, 6))
111111
>c.a : Symbol(a, Decl(test.tsx, 2, 8))
112112
>c : Symbol(c, Decl(test.tsx, 2, 3))

tests/baselines/reference/jsxEmitWithAttributes.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ class A {
114114
<meta content="helloworld"></meta>,
115115
><meta content="helloworld"></meta> : any
116116
>meta : any
117-
>content : any
117+
>content : string
118118
>meta : any
119119

120120
<meta content={c.a!.b}></meta>
121121
><meta content={c.a!.b}></meta> : any
122122
>meta : any
123-
>content : any
123+
>content : string
124124
>c.a!.b : string
125125
>c.a! : { b: string; }
126126
>c.a : { b: string; }

tests/baselines/reference/jsxImportInAttribute.symbols

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let x = Test; // emit test_1.default
99

1010
<anything attr={Test} />; // ?
1111
>anything : Symbol(unknown)
12-
>attr : Symbol(unknown)
12+
>attr : Symbol(attr, Decl(consumer.tsx, 4, 9))
1313
>Test : Symbol(Test, Decl(consumer.tsx, 1, 6))
1414

1515
=== tests/cases/compiler/component.d.ts ===

tests/baselines/reference/jsxImportInAttribute.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let x = Test; // emit test_1.default
1010
<anything attr={Test} />; // ?
1111
><anything attr={Test} /> : any
1212
>anything : any
13-
>attr : any
13+
>attr : typeof Test
1414
>Test : typeof Test
1515

1616
=== tests/cases/compiler/component.d.ts ===

tests/baselines/reference/jsxReactTestSuite.symbols

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,26 @@ var x =
9292
>div : Symbol(unknown)
9393

9494
attr1={
95-
>attr1 : Symbol(unknown)
95+
>attr1 : Symbol(attr1, Decl(jsxReactTestSuite.tsx, 36, 6))
9696

9797
"foo" + "bar"
9898
}
9999
attr2={
100-
>attr2 : Symbol(unknown)
100+
>attr2 : Symbol(attr2, Decl(jsxReactTestSuite.tsx, 39, 5))
101101

102102
"foo" + "bar" +
103103

104104
"baz" + "bug"
105105
}
106106
attr3={
107-
>attr3 : Symbol(unknown)
107+
>attr3 : Symbol(attr3, Decl(jsxReactTestSuite.tsx, 44, 5))
108108

109109
"foo" + "bar" +
110110
"baz" + "bug"
111111
// Extra line here.
112112
}
113113
attr4="baz">
114-
>attr4 : Symbol(unknown)
114+
>attr4 : Symbol(attr4, Decl(jsxReactTestSuite.tsx, 49, 5))
115115

116116
</div>;
117117
>div : Symbol(unknown)
@@ -147,13 +147,13 @@ var x =
147147
/* a multi-line
148148
comment */
149149
attr1="foo">
150-
>attr1 : Symbol(unknown)
150+
>attr1 : Symbol(attr1, Decl(jsxReactTestSuite.tsx, 68, 6))
151151

152152
<span // a double-slash comment
153153
>span : Symbol(unknown)
154154

155155
attr2="bar"
156-
>attr2 : Symbol(unknown)
156+
>attr2 : Symbol(attr2, Decl(jsxReactTestSuite.tsx, 72, 9))
157157

158158
/>
159159
</div>
@@ -175,7 +175,7 @@ var x =
175175

176176
<Component constructor="foo" />;
177177
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
178-
>constructor : Symbol(unknown)
178+
>constructor : Symbol(constructor, Decl(jsxReactTestSuite.tsx, 84, 10))
179179

180180
<Namespace.Component />;
181181
>Namespace : Symbol(Namespace, Decl(jsxReactTestSuite.tsx, 6, 11))
@@ -186,23 +186,23 @@ var x =
186186
<Component { ... x } y
187187
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
188188
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
189-
>y : Symbol(unknown)
189+
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 90, 20))
190190

191191
={2 } z />;
192-
>z : Symbol(unknown)
192+
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 91, 5))
193193

194194
<Component
195195
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
196196

197197
{...this.props} sound="moo" />;
198-
>sound : Symbol(unknown)
198+
>sound : Symbol(sound, Decl(jsxReactTestSuite.tsx, 94, 19))
199199

200200
<font-face />;
201201
>font-face : Symbol(unknown)
202202

203203
<Component x={y} />;
204204
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
205-
>x : Symbol(unknown)
205+
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 98, 10))
206206
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11))
207207

208208
<x-component />;
@@ -215,36 +215,36 @@ var x =
215215
<Component { ...x } y={2} />;
216216
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
217217
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
218-
>y : Symbol(unknown)
218+
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 104, 19))
219219

220220
<Component { ... x } y={2} z />;
221221
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
222222
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
223-
>y : Symbol(unknown)
224-
>z : Symbol(unknown)
223+
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 106, 20))
224+
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 106, 26))
225225

226226
<Component x={1} {...y} />;
227227
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
228-
>x : Symbol(unknown)
228+
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 108, 10))
229229
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11))
230230

231231

232232
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
233233
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
234-
>x : Symbol(unknown)
235-
>y : Symbol(unknown)
234+
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 111, 10))
235+
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 111, 16))
236236
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
237237
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
238238
>Child : Symbol(Child, Decl(jsxReactTestSuite.tsx, 5, 11))
239239
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
240240

241241
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
242242
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
243-
>x : Symbol(unknown)
243+
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 113, 10))
244244
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
245245
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 113, 27))
246246
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
247-
>z : Symbol(unknown)
247+
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 113, 39))
248248
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
249249

250250

0 commit comments

Comments
 (0)