Skip to content

Commit dbae5d2

Browse files
Yui Tmhegazy
Yui T
authored andcommitted
Add more tests and update baselines
1 parent 5eb9fd0 commit dbae5d2

16 files changed

+472
-3
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
tests/cases/conformance/jsx/file.tsx(12,36): error TS2339: Property 'x' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<B1<{}>> & { children?: ReactNode; }'.
2+
3+
4+
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
5+
import React = require('react');
6+
7+
class B1<T extends { x: string }> extends React.Component<T, {}> {
8+
render() {
9+
return <div>hi</div>;
10+
}
11+
}
12+
class B<U> extends React.Component<U, {}> {
13+
props: U;
14+
render() {
15+
// Should be an ok but as of 2.3.3 this will be an error as we will instantiate B1.props to be empty object
16+
return <B1 {...this.props} x="hi" />;
17+
~~~~~~
18+
!!! error TS2339: Property 'x' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<B1<{}>> & { children?: ReactNode; }'.
19+
}
20+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//// [file.tsx]
2+
import React = require('react');
3+
4+
class B1<T extends { x: string }> extends React.Component<T, {}> {
5+
render() {
6+
return <div>hi</div>;
7+
}
8+
}
9+
class B<U> extends React.Component<U, {}> {
10+
props: U;
11+
render() {
12+
// Should be an ok but as of 2.3.3 this will be an error as we will instantiate B1.props to be empty object
13+
return <B1 {...this.props} x="hi" />;
14+
}
15+
}
16+
17+
//// [file.jsx]
18+
"use strict";
19+
var __extends = (this && this.__extends) || (function () {
20+
var extendStatics = Object.setPrototypeOf ||
21+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
23+
return function (d, b) {
24+
extendStatics(d, b);
25+
function __() { this.constructor = d; }
26+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27+
};
28+
})();
29+
exports.__esModule = true;
30+
var React = require("react");
31+
var B1 = (function (_super) {
32+
__extends(B1, _super);
33+
function B1() {
34+
return _super !== null && _super.apply(this, arguments) || this;
35+
}
36+
B1.prototype.render = function () {
37+
return <div>hi</div>;
38+
};
39+
return B1;
40+
}(React.Component));
41+
var B = (function (_super) {
42+
__extends(B, _super);
43+
function B() {
44+
return _super !== null && _super.apply(this, arguments) || this;
45+
}
46+
B.prototype.render = function () {
47+
// Should be an ok but as of 2.3.3 this will be an error as we will instantiate B1.props to be empty object
48+
return <B1 {...this.props} x="hi"/>;
49+
};
50+
return B;
51+
}(React.Component));
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//// [file.tsx]
2+
import React = require('react');
3+
4+
class B1<T extends { x: string } = { x:string } > extends React.Component<T, {}> {
5+
render() {
6+
return <div>hi</div>;
7+
}
8+
}
9+
class B<U> extends React.Component<U, {}> {
10+
props: U;
11+
render() {
12+
return <B1 {...this.props} x="hi" />;
13+
}
14+
}
15+
16+
//// [file.jsx]
17+
"use strict";
18+
var __extends = (this && this.__extends) || (function () {
19+
var extendStatics = Object.setPrototypeOf ||
20+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22+
return function (d, b) {
23+
extendStatics(d, b);
24+
function __() { this.constructor = d; }
25+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26+
};
27+
})();
28+
exports.__esModule = true;
29+
var React = require("react");
30+
var B1 = (function (_super) {
31+
__extends(B1, _super);
32+
function B1() {
33+
return _super !== null && _super.apply(this, arguments) || this;
34+
}
35+
B1.prototype.render = function () {
36+
return <div>hi</div>;
37+
};
38+
return B1;
39+
}(React.Component));
40+
var B = (function (_super) {
41+
__extends(B, _super);
42+
function B() {
43+
return _super !== null && _super.apply(this, arguments) || this;
44+
}
45+
B.prototype.render = function () {
46+
return <B1 {...this.props} x="hi"/>;
47+
};
48+
return B;
49+
}(React.Component));
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : Symbol(React, Decl(file.tsx, 0, 0))
4+
5+
class B1<T extends { x: string } = { x:string } > extends React.Component<T, {}> {
6+
>B1 : Symbol(B1, Decl(file.tsx, 0, 32))
7+
>T : Symbol(T, Decl(file.tsx, 2, 9))
8+
>x : Symbol(x, Decl(file.tsx, 2, 20))
9+
>x : Symbol(x, Decl(file.tsx, 2, 36))
10+
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
11+
>React : Symbol(React, Decl(file.tsx, 0, 0))
12+
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
13+
>T : Symbol(T, Decl(file.tsx, 2, 9))
14+
15+
render() {
16+
>render : Symbol(B1.render, Decl(file.tsx, 2, 82))
17+
18+
return <div>hi</div>;
19+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
20+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
21+
}
22+
}
23+
class B<U> extends React.Component<U, {}> {
24+
>B : Symbol(B, Decl(file.tsx, 6, 1))
25+
>U : Symbol(U, Decl(file.tsx, 7, 8))
26+
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
27+
>React : Symbol(React, Decl(file.tsx, 0, 0))
28+
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
29+
>U : Symbol(U, Decl(file.tsx, 7, 8))
30+
31+
props: U;
32+
>props : Symbol(B.props, Decl(file.tsx, 7, 43))
33+
>U : Symbol(U, Decl(file.tsx, 7, 8))
34+
35+
render() {
36+
>render : Symbol(B.render, Decl(file.tsx, 8, 13))
37+
38+
return <B1 {...this.props} x="hi" />;
39+
>B1 : Symbol(B1, Decl(file.tsx, 0, 32))
40+
>this.props : Symbol(B.props, Decl(file.tsx, 7, 43))
41+
>this : Symbol(B, Decl(file.tsx, 6, 1))
42+
>props : Symbol(B.props, Decl(file.tsx, 7, 43))
43+
>x : Symbol(x, Decl(file.tsx, 10, 34))
44+
}
45+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : typeof React
4+
5+
class B1<T extends { x: string } = { x:string } > extends React.Component<T, {}> {
6+
>B1 : B1<T>
7+
>T : T
8+
>x : string
9+
>x : string
10+
>React.Component : React.Component<T, {}>
11+
>React : typeof React
12+
>Component : typeof React.Component
13+
>T : T
14+
15+
render() {
16+
>render : () => JSX.Element
17+
18+
return <div>hi</div>;
19+
><div>hi</div> : JSX.Element
20+
>div : any
21+
>div : any
22+
}
23+
}
24+
class B<U> extends React.Component<U, {}> {
25+
>B : B<U>
26+
>U : U
27+
>React.Component : React.Component<U, {}>
28+
>React : typeof React
29+
>Component : typeof React.Component
30+
>U : U
31+
32+
props: U;
33+
>props : U
34+
>U : U
35+
36+
render() {
37+
>render : () => JSX.Element
38+
39+
return <B1 {...this.props} x="hi" />;
40+
><B1 {...this.props} x="hi" /> : JSX.Element
41+
>B1 : typeof B1
42+
>this.props : U
43+
>this : this
44+
>props : U
45+
>x : string
46+
}
47+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [file.tsx]
2+
import React = require('react');
3+
4+
declare function Component<T>(props: T) : JSX.Element;
5+
const decorator = function <U>(props: U) {
6+
return <Component {...props} />;
7+
}
8+
9+
const decorator1 = function <U extends {x: string}>(props: U) {
10+
return <Component {...props} x="hi"/>;
11+
}
12+
13+
//// [file.jsx]
14+
"use strict";
15+
exports.__esModule = true;
16+
var React = require("react");
17+
var decorator = function (props) {
18+
return <Component {...props}/>;
19+
};
20+
var decorator1 = function (props) {
21+
return <Component {...props} x="hi"/>;
22+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : Symbol(React, Decl(file.tsx, 0, 0))
4+
5+
declare function Component<T>(props: T) : JSX.Element;
6+
>Component : Symbol(Component, Decl(file.tsx, 0, 32))
7+
>T : Symbol(T, Decl(file.tsx, 2, 27))
8+
>props : Symbol(props, Decl(file.tsx, 2, 30))
9+
>T : Symbol(T, Decl(file.tsx, 2, 27))
10+
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
11+
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
12+
13+
const decorator = function <U>(props: U) {
14+
>decorator : Symbol(decorator, Decl(file.tsx, 3, 5))
15+
>U : Symbol(U, Decl(file.tsx, 3, 28))
16+
>props : Symbol(props, Decl(file.tsx, 3, 31))
17+
>U : Symbol(U, Decl(file.tsx, 3, 28))
18+
19+
return <Component {...props} />;
20+
>Component : Symbol(Component, Decl(file.tsx, 0, 32))
21+
>props : Symbol(props, Decl(file.tsx, 3, 31))
22+
}
23+
24+
const decorator1 = function <U extends {x: string}>(props: U) {
25+
>decorator1 : Symbol(decorator1, Decl(file.tsx, 7, 5))
26+
>U : Symbol(U, Decl(file.tsx, 7, 29))
27+
>x : Symbol(x, Decl(file.tsx, 7, 40))
28+
>props : Symbol(props, Decl(file.tsx, 7, 52))
29+
>U : Symbol(U, Decl(file.tsx, 7, 29))
30+
31+
return <Component {...props} x="hi"/>;
32+
>Component : Symbol(Component, Decl(file.tsx, 0, 32))
33+
>props : Symbol(props, Decl(file.tsx, 7, 52))
34+
>x : Symbol(x, Decl(file.tsx, 8, 32))
35+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : typeof React
4+
5+
declare function Component<T>(props: T) : JSX.Element;
6+
>Component : <T>(props: T) => JSX.Element
7+
>T : T
8+
>props : T
9+
>T : T
10+
>JSX : any
11+
>Element : JSX.Element
12+
13+
const decorator = function <U>(props: U) {
14+
>decorator : <U>(props: U) => JSX.Element
15+
>function <U>(props: U) { return <Component {...props} />;} : <U>(props: U) => JSX.Element
16+
>U : U
17+
>props : U
18+
>U : U
19+
20+
return <Component {...props} />;
21+
><Component {...props} /> : JSX.Element
22+
>Component : <T>(props: T) => JSX.Element
23+
>props : U
24+
}
25+
26+
const decorator1 = function <U extends {x: string}>(props: U) {
27+
>decorator1 : <U extends { x: string; }>(props: U) => JSX.Element
28+
>function <U extends {x: string}>(props: U) { return <Component {...props} x="hi"/>;} : <U extends { x: string; }>(props: U) => JSX.Element
29+
>U : U
30+
>x : string
31+
>props : U
32+
>U : U
33+
34+
return <Component {...props} x="hi"/>;
35+
><Component {...props} x="hi"/> : JSX.Element
36+
>Component : <T>(props: T) => JSX.Element
37+
>props : U
38+
>x : string
39+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [file.tsx]
2+
import React = require('react');
3+
4+
declare function Component<T>(props: T) : JSX.Element;
5+
const decorator = function <U>(props: U) {
6+
return <Component {...props} />;
7+
}
8+
9+
const decorator1 = function <U extends {x: string}>(props: U) {
10+
return <Component {...props} />;
11+
}
12+
13+
//// [file.jsx]
14+
"use strict";
15+
exports.__esModule = true;
16+
var React = require("react");
17+
var decorator = function (props) {
18+
return <Component {...props}/>;
19+
};
20+
var decorator1 = function (props) {
21+
return <Component {...props}/>;
22+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : Symbol(React, Decl(file.tsx, 0, 0))
4+
5+
declare function Component<T>(props: T) : JSX.Element;
6+
>Component : Symbol(Component, Decl(file.tsx, 0, 32))
7+
>T : Symbol(T, Decl(file.tsx, 2, 27))
8+
>props : Symbol(props, Decl(file.tsx, 2, 30))
9+
>T : Symbol(T, Decl(file.tsx, 2, 27))
10+
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
11+
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
12+
13+
const decorator = function <U>(props: U) {
14+
>decorator : Symbol(decorator, Decl(file.tsx, 3, 5))
15+
>U : Symbol(U, Decl(file.tsx, 3, 28))
16+
>props : Symbol(props, Decl(file.tsx, 3, 31))
17+
>U : Symbol(U, Decl(file.tsx, 3, 28))
18+
19+
return <Component {...props} />;
20+
>Component : Symbol(Component, Decl(file.tsx, 0, 32))
21+
>props : Symbol(props, Decl(file.tsx, 3, 31))
22+
}
23+
24+
const decorator1 = function <U extends {x: string}>(props: U) {
25+
>decorator1 : Symbol(decorator1, Decl(file.tsx, 7, 5))
26+
>U : Symbol(U, Decl(file.tsx, 7, 29))
27+
>x : Symbol(x, Decl(file.tsx, 7, 40))
28+
>props : Symbol(props, Decl(file.tsx, 7, 52))
29+
>U : Symbol(U, Decl(file.tsx, 7, 29))
30+
31+
return <Component {...props} />;
32+
>Component : Symbol(Component, Decl(file.tsx, 0, 32))
33+
>props : Symbol(props, Decl(file.tsx, 7, 52))
34+
}

0 commit comments

Comments
 (0)