Skip to content

Commit 40d1719

Browse files
committed
Add module setting + test files
1 parent 8da353e commit 40d1719

File tree

3 files changed

+134
-0
lines changed

3 files changed

+134
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
=== tests/cases/conformance/jsx/react.d.ts ===
2+
3+
declare module 'react' {
4+
class Component<T, U> { }
5+
>Component : Symbol(Component, Decl(react.d.ts, 1, 24))
6+
>T : Symbol(T, Decl(react.d.ts, 2, 17))
7+
>U : Symbol(U, Decl(react.d.ts, 2, 19))
8+
}
9+
10+
=== tests/cases/conformance/jsx/app.tsx ===
11+
import * as React from 'react';
12+
>React : Symbol(React, Decl(app.tsx, 0, 6))
13+
14+
// Should see var button_1 = require('./button') here
15+
import { Button } from './button';
16+
>Button : Symbol(Button, Decl(app.tsx, 3, 8))
17+
18+
export class App extends React.Component<any, any> {
19+
>App : Symbol(App, Decl(app.tsx, 3, 34))
20+
>React.Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
21+
>React : Symbol(React, Decl(app.tsx, 0, 6))
22+
>Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
23+
24+
render() {
25+
>render : Symbol(render, Decl(app.tsx, 5, 52))
26+
27+
return <Button />;
28+
>Button : Symbol(Button, Decl(app.tsx, 3, 8))
29+
}
30+
31+
}
32+
33+
=== tests/cases/conformance/jsx/button.tsx ===
34+
import * as React from 'react';
35+
>React : Symbol(React, Decl(button.tsx, 0, 6))
36+
37+
export class Button extends React.Component<any, any> {
38+
>Button : Symbol(Button, Decl(button.tsx, 0, 31))
39+
>React.Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
40+
>React : Symbol(React, Decl(button.tsx, 0, 6))
41+
>Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
42+
43+
render() {
44+
>render : Symbol(render, Decl(button.tsx, 2, 55))
45+
46+
return <button>Some button</button>;
47+
}
48+
49+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
=== tests/cases/conformance/jsx/react.d.ts ===
2+
3+
declare module 'react' {
4+
class Component<T, U> { }
5+
>Component : Component<T, U>
6+
>T : T
7+
>U : U
8+
}
9+
10+
=== tests/cases/conformance/jsx/app.tsx ===
11+
import * as React from 'react';
12+
>React : typeof React
13+
14+
// Should see var button_1 = require('./button') here
15+
import { Button } from './button';
16+
>Button : typeof Button
17+
18+
export class App extends React.Component<any, any> {
19+
>App : App
20+
>React.Component : React.Component<any, any>
21+
>React : typeof React
22+
>Component : typeof React.Component
23+
24+
render() {
25+
>render : () => any
26+
27+
return <Button />;
28+
><Button /> : any
29+
>Button : typeof Button
30+
}
31+
32+
}
33+
34+
=== tests/cases/conformance/jsx/button.tsx ===
35+
import * as React from 'react';
36+
>React : typeof React
37+
38+
export class Button extends React.Component<any, any> {
39+
>Button : Button
40+
>React.Component : React.Component<any, any>
41+
>React : typeof React
42+
>Component : typeof React.Component
43+
44+
render() {
45+
>render : () => any
46+
47+
return <button>Some button</button>;
48+
><button>Some button</button> : any
49+
>button : any
50+
>button : any
51+
}
52+
53+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//@jsx: preserve
2+
//@module: commonjs
3+
4+
//@filename: react.d.ts
5+
declare module 'react' {
6+
class Component<T, U> { }
7+
}
8+
9+
//@filename: app.tsx
10+
import * as React from 'react';
11+
12+
// Should see var button_1 = require('./button') here
13+
import { Button } from './button';
14+
15+
export class App extends React.Component<any, any> {
16+
17+
render() {
18+
return <Button />;
19+
}
20+
21+
}
22+
23+
//@filename: button.tsx
24+
import * as React from 'react';
25+
26+
export class Button extends React.Component<any, any> {
27+
28+
render() {
29+
return <button>Some button</button>;
30+
}
31+
32+
}

0 commit comments

Comments
 (0)