|
| 1 | +=== tests/cases/conformance/jsx/file.tsx === |
| 2 | + |
| 3 | +import React = require('react'); |
| 4 | +>React : Symbol(React, Decl(file.tsx, 0, 0)) |
| 5 | + |
| 6 | +interface ComponentProps { |
| 7 | +>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 1, 32)) |
| 8 | + |
| 9 | + AnyComponent: React.StatelessComponent<any> | React.ComponentClass<any>; |
| 10 | +>AnyComponent : Symbol(ComponentProps.AnyComponent, Decl(file.tsx, 3, 26)) |
| 11 | +>React : Symbol(React, Decl(file.tsx, 0, 0)) |
| 12 | +>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 139, 5)) |
| 13 | +>React : Symbol(React, Decl(file.tsx, 0, 0)) |
| 14 | +>ComponentClass : Symbol(React.ComponentClass, Decl(react.d.ts, 150, 5)) |
| 15 | +} |
| 16 | + |
| 17 | +class MyComponent extends React.Component<ComponentProps, {}> { |
| 18 | +>MyComponent : Symbol(MyComponent, Decl(file.tsx, 5, 1)) |
| 19 | +>React.Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) |
| 20 | +>React : Symbol(React, Decl(file.tsx, 0, 0)) |
| 21 | +>Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) |
| 22 | +>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 1, 32)) |
| 23 | + |
| 24 | + render() { |
| 25 | +>render : Symbol(MyComponent.render, Decl(file.tsx, 7, 63)) |
| 26 | + |
| 27 | + const { AnyComponent } = this.props; |
| 28 | +>AnyComponent : Symbol(AnyComponent, Decl(file.tsx, 9, 15)) |
| 29 | +>this.props : Symbol(React.Component.props, Decl(react.d.ts, 122, 30)) |
| 30 | +>this : Symbol(MyComponent, Decl(file.tsx, 5, 1)) |
| 31 | +>props : Symbol(React.Component.props, Decl(react.d.ts, 122, 30)) |
| 32 | + |
| 33 | + return (<AnyComponent />); |
| 34 | +>AnyComponent : Symbol(AnyComponent, Decl(file.tsx, 9, 15)) |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +// Stateless Component As Props |
| 39 | +<MyComponent AnyComponent={() => <button>test</button>}/> |
| 40 | +>MyComponent : Symbol(MyComponent, Decl(file.tsx, 5, 1)) |
| 41 | +>AnyComponent : Symbol(ComponentProps.AnyComponent, Decl(file.tsx, 3, 26)) |
| 42 | +>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 913, 43)) |
| 43 | +>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 913, 43)) |
| 44 | + |
| 45 | +// Component Class as Props |
| 46 | +class MyButtonComponent extends React.Component<{},{}> { |
| 47 | +>MyButtonComponent : Symbol(MyButtonComponent, Decl(file.tsx, 15, 57)) |
| 48 | +>React.Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) |
| 49 | +>React : Symbol(React, Decl(file.tsx, 0, 0)) |
| 50 | +>Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) |
| 51 | +} |
| 52 | + |
| 53 | +<MyComponent AnyComponent={MyButtonComponent} /> |
| 54 | +>MyComponent : Symbol(MyComponent, Decl(file.tsx, 5, 1)) |
| 55 | +>AnyComponent : Symbol(ComponentProps.AnyComponent, Decl(file.tsx, 3, 26)) |
| 56 | +>MyButtonComponent : Symbol(MyButtonComponent, Decl(file.tsx, 15, 57)) |
| 57 | + |
| 58 | + |
0 commit comments