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
|
=== tests/cases/compiler/jsxInferenceProducesLiteralAsExpected.tsx ===
import React = require("react");
>React : typeof React
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];
>FunctionPropertyNames : FunctionPropertyNames<T>
class TestObject {
>TestObject : TestObject
a: string = '';
>a : string
>'' : ""
b: number = 1;
>b : number
>1 : 1
c: () => void = () => { };
>c : () => void
>() => { } : () => void
}
interface TestProps<T> {
model: T;
>model : T
foo: FunctionPropertyNames<T>;
>foo : FunctionPropertyNames<T>
}
function Test<T>(props: TestProps<T>) { return <></>; }
>Test : <T>(props: TestProps<T>) => JSX.Element
>props : TestProps<T>
><></> : JSX.Element
const model = new TestObject();
>model : TestObject
>new TestObject() : TestObject
>TestObject : typeof TestObject
const el1 = <Test model={model} foo="c" />;
>el1 : JSX.Element
><Test model={model} foo="c" /> : JSX.Element
>Test : <T>(props: TestProps<T>) => JSX.Element
>model : TestObject
>model : TestObject
>foo : "c"
const el2 = <Test<TestObject> model={model} foo="c" />;
>el2 : JSX.Element
><Test<TestObject> model={model} foo="c" /> : JSX.Element
>Test : <T>(props: TestProps<T>) => JSX.Element
>model : TestObject
>model : TestObject
>foo : "c"
|