Skip to content

Commit eb0ad7f

Browse files
author
Kanchalai Tanglertsampan
committed
update baselines
1 parent f099046 commit eb0ad7f

24 files changed

Lines changed: 1714 additions & 13 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//// [file.tsx]
2+
import React = require('react');
3+
4+
interface Prop {
5+
a: number,
6+
b: string,
7+
children: string | JSX.Element
8+
}
9+
10+
function Comp(p: Prop) {
11+
return <div>{p.b}</div>;
12+
}
13+
14+
// OK
15+
let k = <Comp a={10} b="hi" children ="lol" />;
16+
let k1 =
17+
<Comp a={10} b="hi">
18+
hi hi hi!
19+
</Comp>;
20+
let k2 =
21+
<Comp a={10} b="hi">
22+
<div>hi hi hi!</div>
23+
</Comp>;
24+
25+
//// [file.jsx]
26+
"use strict";
27+
exports.__esModule = true;
28+
var React = require("react");
29+
function Comp(p) {
30+
return <div>{p.b}</div>;
31+
}
32+
// OK
33+
var k = <Comp a={10} b="hi" children="lol"/>;
34+
var k1 = <Comp a={10} b="hi">
35+
hi hi hi!
36+
</Comp>;
37+
var k2 = <Comp a={10} b="hi">
38+
<div>hi hi hi!</div>
39+
</Comp>;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : Symbol(React, Decl(file.tsx, 0, 0))
4+
5+
interface Prop {
6+
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
7+
8+
a: number,
9+
>a : Symbol(Prop.a, Decl(file.tsx, 2, 16))
10+
11+
b: string,
12+
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
13+
14+
children: string | JSX.Element
15+
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
16+
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
17+
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
18+
}
19+
20+
function Comp(p: Prop) {
21+
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
22+
>p : Symbol(p, Decl(file.tsx, 8, 14))
23+
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
24+
25+
return <div>{p.b}</div>;
26+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
27+
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
28+
>p : Symbol(p, Decl(file.tsx, 8, 14))
29+
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
30+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
31+
}
32+
33+
// OK
34+
let k = <Comp a={10} b="hi" children ="lol" />;
35+
>k : Symbol(k, Decl(file.tsx, 13, 3))
36+
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
37+
>a : Symbol(a, Decl(file.tsx, 13, 13))
38+
>b : Symbol(b, Decl(file.tsx, 13, 20))
39+
>children : Symbol(children, Decl(file.tsx, 13, 27))
40+
41+
let k1 =
42+
>k1 : Symbol(k1, Decl(file.tsx, 14, 3))
43+
44+
<Comp a={10} b="hi">
45+
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
46+
>a : Symbol(a, Decl(file.tsx, 15, 9))
47+
>b : Symbol(b, Decl(file.tsx, 15, 16))
48+
49+
hi hi hi!
50+
</Comp>;
51+
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
52+
53+
let k2 =
54+
>k2 : Symbol(k2, Decl(file.tsx, 18, 3))
55+
56+
<Comp a={10} b="hi">
57+
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
58+
>a : Symbol(a, Decl(file.tsx, 19, 9))
59+
>b : Symbol(b, Decl(file.tsx, 19, 16))
60+
61+
<div>hi hi hi!</div>
62+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
63+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
64+
65+
</Comp>;
66+
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
67+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : typeof React
4+
5+
interface Prop {
6+
>Prop : Prop
7+
8+
a: number,
9+
>a : number
10+
11+
b: string,
12+
>b : string
13+
14+
children: string | JSX.Element
15+
>children : string | JSX.Element
16+
>JSX : any
17+
>Element : JSX.Element
18+
}
19+
20+
function Comp(p: Prop) {
21+
>Comp : (p: Prop) => JSX.Element
22+
>p : Prop
23+
>Prop : Prop
24+
25+
return <div>{p.b}</div>;
26+
><div>{p.b}</div> : JSX.Element
27+
>div : any
28+
>p.b : string
29+
>p : Prop
30+
>b : string
31+
>div : any
32+
}
33+
34+
// OK
35+
let k = <Comp a={10} b="hi" children ="lol" />;
36+
>k : JSX.Element
37+
><Comp a={10} b="hi" children ="lol" /> : JSX.Element
38+
>Comp : (p: Prop) => JSX.Element
39+
>a : number
40+
>10 : 10
41+
>b : string
42+
>children : string
43+
44+
let k1 =
45+
>k1 : JSX.Element
46+
47+
<Comp a={10} b="hi">
48+
><Comp a={10} b="hi"> hi hi hi! </Comp> : JSX.Element
49+
>Comp : (p: Prop) => JSX.Element
50+
>a : number
51+
>10 : 10
52+
>b : string
53+
54+
hi hi hi!
55+
</Comp>;
56+
>Comp : (p: Prop) => JSX.Element
57+
58+
let k2 =
59+
>k2 : JSX.Element
60+
61+
<Comp a={10} b="hi">
62+
><Comp a={10} b="hi"> <div>hi hi hi!</div> </Comp> : JSX.Element
63+
>Comp : (p: Prop) => JSX.Element
64+
>a : number
65+
>10 : 10
66+
>b : string
67+
68+
<div>hi hi hi!</div>
69+
><div>hi hi hi!</div> : JSX.Element
70+
>div : any
71+
>div : any
72+
73+
</Comp>;
74+
>Comp : (p: Prop) => JSX.Element
75+
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
tests/cases/conformance/jsx/file.tsx(14,15): error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'.
2+
Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
3+
Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
4+
tests/cases/conformance/jsx/file.tsx(17,11): error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten.
5+
tests/cases/conformance/jsx/file.tsx(23,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
6+
Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' 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(29,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
12+
Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'Prop'.
13+
Types of property 'children' are incompatible.
14+
Type '(Element | 1000000)[]' is not assignable to type 'string | Element'.
15+
Type '(Element | 1000000)[]' is not assignable to type 'Element'.
16+
Property 'type' is missing in type '(Element | 1000000)[]'.
17+
tests/cases/conformance/jsx/file.tsx(35,11): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
18+
Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' 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(41,11): error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
24+
Type '{ a: 10; b: "hi"; children: Element[]; }' 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'.
28+
Property 'type' is missing in type 'Element[]'.
29+
30+
31+
==== tests/cases/conformance/jsx/file.tsx (6 errors) ====
32+
import React = require('react');
33+
34+
interface Prop {
35+
a: number,
36+
b: string,
37+
children: string | JSX.Element
38+
}
39+
40+
function Comp(p: Prop) {
41+
return <div>{p.b}</div>;
42+
}
43+
44+
// Error: missing children
45+
let k = <Comp a={10} b="hi" />;
46+
~~~~~~~~~~~~~
47+
!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'.
48+
!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
49+
!!! error TS2322: Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
50+
51+
let k1 =
52+
<Comp a={10} b="hi" children="Random" >
53+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54+
!!! error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten.
55+
hi hi hi!
56+
</Comp>;
57+
58+
// Error: incorrect type
59+
let k2 =
60+
<Comp a={10} b="hi">
61+
~~~~~~~~~~~~~
62+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
63+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'.
64+
!!! error TS2322: Types of property 'children' are incompatible.
65+
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
66+
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
67+
!!! error TS2322: Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
68+
<div> My Div </div>
69+
{(name: string) => <div> My name {name} </div>}
70+
</Comp>;
71+
72+
let k3 =
73+
<Comp a={10} b="hi">
74+
~~~~~~~~~~~~~
75+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
76+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'Prop'.
77+
!!! error TS2322: Types of property 'children' are incompatible.
78+
!!! error TS2322: Type '(Element | 1000000)[]' is not assignable to type 'string | Element'.
79+
!!! error TS2322: Type '(Element | 1000000)[]' is not assignable to type 'Element'.
80+
!!! error TS2322: Property 'type' is missing in type '(Element | 1000000)[]'.
81+
<div> My Div </div>
82+
{1000000}
83+
</Comp>;
84+
85+
let k4 =
86+
<Comp a={10} b="hi" >
87+
~~~~~~~~~~~~~
88+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
89+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
90+
!!! error TS2322: Types of property 'children' are incompatible.
91+
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'string | Element'.
92+
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element'.
93+
!!! error TS2322: Property 'type' is missing in type '(string | Element)[]'.
94+
<div> My Div </div>
95+
hi hi hi!
96+
</Comp>;
97+
98+
let k5 =
99+
<Comp a={10} b="hi" >
100+
~~~~~~~~~~~~~
101+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
102+
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'Prop'.
103+
!!! error TS2322: Types of property 'children' are incompatible.
104+
!!! error TS2322: Type 'Element[]' is not assignable to type 'string | Element'.
105+
!!! error TS2322: Type 'Element[]' is not assignable to type 'Element'.
106+
!!! error TS2322: Property 'type' is missing in type 'Element[]'.
107+
<div> My Div </div>
108+
<div> My Div </div>
109+
</Comp>;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
//// [file.tsx]
2+
import React = require('react');
3+
4+
interface Prop {
5+
a: number,
6+
b: string,
7+
children: string | JSX.Element
8+
}
9+
10+
function Comp(p: Prop) {
11+
return <div>{p.b}</div>;
12+
}
13+
14+
// Error: missing children
15+
let k = <Comp a={10} b="hi" />;
16+
17+
let k1 =
18+
<Comp a={10} b="hi" children="Random" >
19+
hi hi hi!
20+
</Comp>;
21+
22+
// Error: incorrect type
23+
let k2 =
24+
<Comp a={10} b="hi">
25+
<div> My Div </div>
26+
{(name: string) => <div> My name {name} </div>}
27+
</Comp>;
28+
29+
let k3 =
30+
<Comp a={10} b="hi">
31+
<div> My Div </div>
32+
{1000000}
33+
</Comp>;
34+
35+
let k4 =
36+
<Comp a={10} b="hi" >
37+
<div> My Div </div>
38+
hi hi hi!
39+
</Comp>;
40+
41+
let k5 =
42+
<Comp a={10} b="hi" >
43+
<div> My Div </div>
44+
<div> My Div </div>
45+
</Comp>;
46+
47+
//// [file.jsx]
48+
"use strict";
49+
exports.__esModule = true;
50+
var React = require("react");
51+
function Comp(p) {
52+
return <div>{p.b}</div>;
53+
}
54+
// Error: missing children
55+
var k = <Comp a={10} b="hi"/>;
56+
var k1 = <Comp a={10} b="hi" children="Random">
57+
hi hi hi!
58+
</Comp>;
59+
// Error: incorrect type
60+
var k2 = <Comp a={10} b="hi">
61+
<div> My Div </div>
62+
{function (name) { return <div> My name {name} </div>; }}
63+
</Comp>;
64+
var k3 = <Comp a={10} b="hi">
65+
<div> My Div </div>
66+
{1000000}
67+
</Comp>;
68+
var k4 = <Comp a={10} b="hi">
69+
<div> My Div </div>
70+
hi hi hi!
71+
</Comp>;
72+
var k5 = <Comp a={10} b="hi">
73+
<div> My Div </div>
74+
<div> My Div </div>
75+
</Comp>;

0 commit comments

Comments
 (0)