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 83 84 85 86 87 88 89 90 91
|
=== tests/cases/conformance/jsx/react.d.ts ===
declare module JSX {
interface Element { }
interface IntrinsicElements {
}
interface ElementAttributesProperty {
props;
>props : any
}
interface IntrinsicAttributes {
ref?: string;
>ref : string
}
}
=== tests/cases/conformance/jsx/file.tsx ===
declare class Component<P, S> {
>Component : Component<P, S>
constructor(props?: P, context?: any);
>props : P
>context : any
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
>setState : { (f: (prevState: S, props: P) => S, callback?: () => any): void; (state: S, callback?: () => any): void; }
>f : (prevState: S, props: P) => S
>prevState : S
>props : P
>callback : () => any
setState(state: S, callback?: () => any): void;
>setState : { (f: (prevState: S, props: P) => S, callback?: () => any): void; (state: S, callback?: () => any): void; }
>state : S
>callback : () => any
forceUpdate(callBack?: () => any): void;
>forceUpdate : (callBack?: () => any) => void
>callBack : () => any
render(): JSX.Element;
>render : () => JSX.Element
>JSX : any
props: P;
>props : P
state: S;
>state : S
context: {};
>context : {}
}
interface ComponentClass<P> {
new (props?: P, context?: any): Component<P, any>;
>props : P
>context : any
}
declare module TestMod {
>TestMod : typeof TestMod
interface TestClass extends ComponentClass<{reqd: any}> {
>reqd : any
}
var Test: TestClass;
>Test : TestClass
}
// Errors correctly
const T = TestMod.Test;
>T : TestMod.TestClass
>TestMod.Test : TestMod.TestClass
>TestMod : typeof TestMod
>Test : TestMod.TestClass
var t1 = <T />;
>t1 : JSX.Element
><T /> : JSX.Element
>T : TestMod.TestClass
// Should error
var t2 = <TestMod.Test />;
>t2 : JSX.Element
><TestMod.Test /> : JSX.Element
>TestMod.Test : TestMod.TestClass
>TestMod : typeof TestMod
>Test : TestMod.TestClass
|