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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react')
>React : Symbol(React, Decl(file.tsx, 0, 0))
declare function ComponentSpecific1<U>(l: {prop: U, "ignore-prop": string}): JSX.Element;
>ComponentSpecific1 : Symbol(ComponentSpecific1, Decl(file.tsx, 0, 31))
>U : Symbol(U, Decl(file.tsx, 2, 36))
>l : Symbol(l, Decl(file.tsx, 2, 39))
>prop : Symbol(prop, Decl(file.tsx, 2, 43))
>U : Symbol(U, Decl(file.tsx, 2, 36))
>"ignore-prop" : Symbol("ignore-prop", Decl(file.tsx, 2, 51))
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
declare function ComponentSpecific2<U>(l: {prop: U}): JSX.Element;
>ComponentSpecific2 : Symbol(ComponentSpecific2, Decl(file.tsx, 2, 89))
>U : Symbol(U, Decl(file.tsx, 3, 36))
>l : Symbol(l, Decl(file.tsx, 3, 39))
>prop : Symbol(prop, Decl(file.tsx, 3, 43))
>U : Symbol(U, Decl(file.tsx, 3, 36))
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
// Error
function Bar<T extends {prop: number}>(arg: T) {
>Bar : Symbol(Bar, Decl(file.tsx, 3, 66))
>T : Symbol(T, Decl(file.tsx, 6, 13))
>prop : Symbol(prop, Decl(file.tsx, 6, 24))
>arg : Symbol(arg, Decl(file.tsx, 6, 39))
>T : Symbol(T, Decl(file.tsx, 6, 13))
let a1 = <ComponentSpecific1 {...arg} ignore-prop={10} />;
>a1 : Symbol(a1, Decl(file.tsx, 7, 7))
>ComponentSpecific1 : Symbol(ComponentSpecific1, Decl(file.tsx, 0, 31))
>arg : Symbol(arg, Decl(file.tsx, 6, 39))
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 7, 41))
}
// Error
function Baz<T>(arg: T) {
>Baz : Symbol(Baz, Decl(file.tsx, 8, 2))
>T : Symbol(T, Decl(file.tsx, 11, 13))
>arg : Symbol(arg, Decl(file.tsx, 11, 16))
>T : Symbol(T, Decl(file.tsx, 11, 13))
let a0 = <ComponentSpecific1 {...arg} />
>a0 : Symbol(a0, Decl(file.tsx, 12, 7))
>ComponentSpecific1 : Symbol(ComponentSpecific1, Decl(file.tsx, 0, 31))
>arg : Symbol(arg, Decl(file.tsx, 11, 16))
}
declare function Link<U>(l: {func: (arg: U)=>void}): JSX.Element;
>Link : Symbol(Link, Decl(file.tsx, 13, 1))
>U : Symbol(U, Decl(file.tsx, 15, 22))
>l : Symbol(l, Decl(file.tsx, 15, 25))
>func : Symbol(func, Decl(file.tsx, 15, 29))
>arg : Symbol(arg, Decl(file.tsx, 15, 36))
>U : Symbol(U, Decl(file.tsx, 15, 22))
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
// Error
function createLink(func: (a: number, b: string)=>void) {
>createLink : Symbol(createLink, Decl(file.tsx, 15, 65))
>func : Symbol(func, Decl(file.tsx, 18, 20))
>a : Symbol(a, Decl(file.tsx, 18, 27))
>b : Symbol(b, Decl(file.tsx, 18, 37))
let o = <Link func={func} />
>o : Symbol(o, Decl(file.tsx, 19, 7))
>Link : Symbol(Link, Decl(file.tsx, 13, 1))
>func : Symbol(func, Decl(file.tsx, 19, 17))
>func : Symbol(func, Decl(file.tsx, 18, 20))
}
interface InferParamProp<T> {
>InferParamProp : Symbol(InferParamProp, Decl(file.tsx, 20, 1))
>T : Symbol(T, Decl(file.tsx, 22, 25))
values: Array<T>;
>values : Symbol(InferParamProp.values, Decl(file.tsx, 22, 29))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>T : Symbol(T, Decl(file.tsx, 22, 25))
selectHandler: (selectedVal: T) => void;
>selectHandler : Symbol(InferParamProp.selectHandler, Decl(file.tsx, 23, 21))
>selectedVal : Symbol(selectedVal, Decl(file.tsx, 24, 20))
>T : Symbol(T, Decl(file.tsx, 22, 25))
}
declare function InferParamComponent<T>(attr: InferParamProp<T>): JSX.Element;
>InferParamComponent : Symbol(InferParamComponent, Decl(file.tsx, 25, 1))
>T : Symbol(T, Decl(file.tsx, 27, 37))
>attr : Symbol(attr, Decl(file.tsx, 27, 40))
>InferParamProp : Symbol(InferParamProp, Decl(file.tsx, 20, 1))
>T : Symbol(T, Decl(file.tsx, 27, 37))
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
// Error
let i = <InferParamComponent values={[1, 2, 3, 4]} selectHandler={(val: string) => { }} />;
>i : Symbol(i, Decl(file.tsx, 30, 3))
>InferParamComponent : Symbol(InferParamComponent, Decl(file.tsx, 25, 1))
>values : Symbol(values, Decl(file.tsx, 30, 28))
>selectHandler : Symbol(selectHandler, Decl(file.tsx, 30, 50))
>val : Symbol(val, Decl(file.tsx, 30, 67))
|