Add module setting + test files

This commit is contained in:
Ryan Cavanaugh 2015-06-29 11:41:40 -07:00
parent 8da353e169
commit 40d1719eb7
3 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,49 @@
=== tests/cases/conformance/jsx/react.d.ts ===
declare module 'react' {
class Component<T, U> { }
>Component : Symbol(Component, Decl(react.d.ts, 1, 24))
>T : Symbol(T, Decl(react.d.ts, 2, 17))
>U : Symbol(U, Decl(react.d.ts, 2, 19))
}
=== tests/cases/conformance/jsx/app.tsx ===
import * as React from 'react';
>React : Symbol(React, Decl(app.tsx, 0, 6))
// Should see var button_1 = require('./button') here
import { Button } from './button';
>Button : Symbol(Button, Decl(app.tsx, 3, 8))
export class App extends React.Component<any, any> {
>App : Symbol(App, Decl(app.tsx, 3, 34))
>React.Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
>React : Symbol(React, Decl(app.tsx, 0, 6))
>Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
render() {
>render : Symbol(render, Decl(app.tsx, 5, 52))
return <Button />;
>Button : Symbol(Button, Decl(app.tsx, 3, 8))
}
}
=== tests/cases/conformance/jsx/button.tsx ===
import * as React from 'react';
>React : Symbol(React, Decl(button.tsx, 0, 6))
export class Button extends React.Component<any, any> {
>Button : Symbol(Button, Decl(button.tsx, 0, 31))
>React.Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
>React : Symbol(React, Decl(button.tsx, 0, 6))
>Component : Symbol(React.Component, Decl(react.d.ts, 1, 24))
render() {
>render : Symbol(render, Decl(button.tsx, 2, 55))
return <button>Some button</button>;
}
}

View File

@ -0,0 +1,53 @@
=== tests/cases/conformance/jsx/react.d.ts ===
declare module 'react' {
class Component<T, U> { }
>Component : Component<T, U>
>T : T
>U : U
}
=== tests/cases/conformance/jsx/app.tsx ===
import * as React from 'react';
>React : typeof React
// Should see var button_1 = require('./button') here
import { Button } from './button';
>Button : typeof Button
export class App extends React.Component<any, any> {
>App : App
>React.Component : React.Component<any, any>
>React : typeof React
>Component : typeof React.Component
render() {
>render : () => any
return <Button />;
><Button /> : any
>Button : typeof Button
}
}
=== tests/cases/conformance/jsx/button.tsx ===
import * as React from 'react';
>React : typeof React
export class Button extends React.Component<any, any> {
>Button : Button
>React.Component : React.Component<any, any>
>React : typeof React
>Component : typeof React.Component
render() {
>render : () => any
return <button>Some button</button>;
><button>Some button</button> : any
>button : any
>button : any
}
}

View File

@ -0,0 +1,32 @@
//@jsx: preserve
//@module: commonjs
//@filename: react.d.ts
declare module 'react' {
class Component<T, U> { }
}
//@filename: app.tsx
import * as React from 'react';
// Should see var button_1 = require('./button') here
import { Button } from './button';
export class App extends React.Component<any, any> {
render() {
return <Button />;
}
}
//@filename: button.tsx
import * as React from 'react';
export class Button extends React.Component<any, any> {
render() {
return <button>Some button</button>;
}
}