1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : Symbol(React, Decl(file.tsx, 0, 0))
interface Prop {
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
a: number,
>a : Symbol(Prop.a, Decl(file.tsx, 2, 16))
b: string,
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
children: Button;
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
}
class Button extends React.Component<any, any> {
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
>React : Symbol(React, Decl(file.tsx, 0, 0))
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
render() {
>render : Symbol(Button.render, Decl(file.tsx, 8, 48))
return (<div>My Button</div>)
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
}
}
function Comp(p: Prop) {
>Comp : Symbol(Comp, Decl(file.tsx, 12, 1))
>p : Symbol(p, Decl(file.tsx, 14, 14))
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
return <div>{p.b}</div>;
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
>p : Symbol(p, Decl(file.tsx, 14, 14))
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
}
// Error: no children specified
let k = <Comp a={10} b="hi" />;
>k : Symbol(k, Decl(file.tsx, 19, 3))
>Comp : Symbol(Comp, Decl(file.tsx, 12, 1))
>a : Symbol(a, Decl(file.tsx, 19, 13))
>b : Symbol(b, Decl(file.tsx, 19, 20))
// Error: JSX.element is not the same as JSX.ElementClass
let k1 =
>k1 : Symbol(k1, Decl(file.tsx, 22, 3))
<Comp a={10} b="hi">
>Comp : Symbol(Comp, Decl(file.tsx, 12, 1))
>a : Symbol(a, Decl(file.tsx, 23, 9))
>b : Symbol(b, Decl(file.tsx, 23, 16))
<Button />
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
</Comp>;
>Comp : Symbol(Comp, Decl(file.tsx, 12, 1))
let k2 =
>k2 : Symbol(k2, Decl(file.tsx, 26, 3))
<Comp a={10} b="hi">
>Comp : Symbol(Comp, Decl(file.tsx, 12, 1))
>a : Symbol(a, Decl(file.tsx, 27, 9))
>b : Symbol(b, Decl(file.tsx, 27, 16))
{Button}
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
</Comp>;
>Comp : Symbol(Comp, Decl(file.tsx, 12, 1))
|