Skip to content

Commit 6f5f3c5

Browse files
author
Philipp Zins
committed
added tests
1 parent 0128d3f commit 6f5f3c5

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//// [file.tsx]
2+
import React = require('react');
3+
4+
const Foo = (props: any) => [<span />, <span />];
5+
6+
function Greet(x: { name?: string }) {
7+
return [<span />, <span />];
8+
}
9+
10+
const foo = <Foo />;
11+
const G = <Greet />;
12+
13+
14+
//// [file.jsx]
15+
define(["require", "exports", "react"], function (require, exports, React) {
16+
"use strict";
17+
exports.__esModule = true;
18+
var Foo = function (props) { return [<span />, <span />]; };
19+
function Greet(x) {
20+
return [<span />, <span />];
21+
}
22+
var foo = <Foo />;
23+
var G = <Greet />;
24+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : Symbol(React, Decl(file.tsx, 0, 0))
4+
5+
const Foo = (props: any) => [<span />, <span />];
6+
>Foo : Symbol(Foo, Decl(file.tsx, 2, 5))
7+
>props : Symbol(props, Decl(file.tsx, 2, 13))
8+
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
9+
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
10+
11+
function Greet(x: { name?: string }) {
12+
>Greet : Symbol(Greet, Decl(file.tsx, 2, 49))
13+
>x : Symbol(x, Decl(file.tsx, 4, 15))
14+
>name : Symbol(name, Decl(file.tsx, 4, 19))
15+
16+
return [<span />, <span />];
17+
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
18+
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
19+
}
20+
21+
const foo = <Foo />;
22+
>foo : Symbol(foo, Decl(file.tsx, 8, 5))
23+
>Foo : Symbol(Foo, Decl(file.tsx, 2, 5))
24+
25+
const G = <Greet />;
26+
>G : Symbol(G, Decl(file.tsx, 9, 5))
27+
>Greet : Symbol(Greet, Decl(file.tsx, 2, 49))
28+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
=== tests/cases/conformance/jsx/file.tsx ===
2+
import React = require('react');
3+
>React : typeof React
4+
5+
const Foo = (props: any) => [<span />, <span />];
6+
>Foo : (props: any) => JSX.Element[]
7+
>(props: any) => [<span />, <span />] : (props: any) => JSX.Element[]
8+
>props : any
9+
>[<span />, <span />] : JSX.Element[]
10+
><span /> : JSX.Element
11+
>span : any
12+
><span /> : JSX.Element
13+
>span : any
14+
15+
function Greet(x: { name?: string }) {
16+
>Greet : (x: { name?: string; }) => JSX.Element[]
17+
>x : { name?: string; }
18+
>name : string
19+
20+
return [<span />, <span />];
21+
>[<span />, <span />] : JSX.Element[]
22+
><span /> : JSX.Element
23+
>span : any
24+
><span /> : JSX.Element
25+
>span : any
26+
}
27+
28+
const foo = <Foo />;
29+
>foo : JSX.Element
30+
><Foo /> : JSX.Element
31+
>Foo : (props: any) => JSX.Element[]
32+
33+
const G = <Greet />;
34+
>G : JSX.Element
35+
><Greet /> : JSX.Element
36+
>Greet : (x: { name?: string; }) => JSX.Element[]
37+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @filename: file.tsx
2+
// @jsx: preserve
3+
// @module: amd
4+
// @noLib: true
5+
// @skipLibCheck: true
6+
// @libFiles: react.d.ts,lib.d.ts
7+
8+
import React = require('react');
9+
10+
const Foo = (props: any) => [<span />, <span />];
11+
12+
function Greet(x: { name?: string }) {
13+
return [<span />, <span />];
14+
}
15+
16+
const foo = <Foo />;
17+
const G = <Greet />;

0 commit comments

Comments
 (0)