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 108 109 110 111 112 113 114 115 116 117 118 119
|
=== tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx ===
namespace JSX {
>JSX : Symbol(JSX, Decl(jsxChildrenGenericContextualTypes.tsx, 0, 0))
export interface Element {}
>Element : Symbol(Element, Decl(jsxChildrenGenericContextualTypes.tsx, 0, 15))
export interface ElementAttributesProperty { props: {}; }
>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(jsxChildrenGenericContextualTypes.tsx, 1, 31))
>props : Symbol(ElementAttributesProperty.props, Decl(jsxChildrenGenericContextualTypes.tsx, 2, 48))
export interface ElementChildrenAttribute { children: {}; }
>ElementChildrenAttribute : Symbol(ElementChildrenAttribute, Decl(jsxChildrenGenericContextualTypes.tsx, 2, 61))
>children : Symbol(ElementChildrenAttribute.children, Decl(jsxChildrenGenericContextualTypes.tsx, 3, 47))
export interface IntrinsicAttributes {}
>IntrinsicAttributes : Symbol(IntrinsicAttributes, Decl(jsxChildrenGenericContextualTypes.tsx, 3, 63))
export interface IntrinsicElements { [key: string]: Element }
>IntrinsicElements : Symbol(IntrinsicElements, Decl(jsxChildrenGenericContextualTypes.tsx, 4, 43))
>key : Symbol(key, Decl(jsxChildrenGenericContextualTypes.tsx, 5, 42))
>Element : Symbol(Element, Decl(jsxChildrenGenericContextualTypes.tsx, 0, 15))
}
const Elem = <T,U=never>(p: { prop: T, children: (t: T) => T }) => <div></div>;
>Elem : Symbol(Elem, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 5))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 14))
>U : Symbol(U, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 16))
>p : Symbol(p, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 25))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 29))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 14))
>children : Symbol(children, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 38))
>t : Symbol(t, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 50))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 14))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 14))
>div : Symbol(JSX.IntrinsicElements, Decl(jsxChildrenGenericContextualTypes.tsx, 4, 43))
>div : Symbol(JSX.IntrinsicElements, Decl(jsxChildrenGenericContextualTypes.tsx, 4, 43))
Elem({prop: {a: "x"}, children: i => ({a: "z"})});
>Elem : Symbol(Elem, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 8, 6))
>a : Symbol(a, Decl(jsxChildrenGenericContextualTypes.tsx, 8, 13))
>children : Symbol(children, Decl(jsxChildrenGenericContextualTypes.tsx, 8, 21))
>i : Symbol(i, Decl(jsxChildrenGenericContextualTypes.tsx, 8, 31))
>a : Symbol(a, Decl(jsxChildrenGenericContextualTypes.tsx, 8, 39))
const q = <Elem prop={{a: "x"}} children={i => ({a: "z"})} />
>q : Symbol(q, Decl(jsxChildrenGenericContextualTypes.tsx, 9, 5))
>Elem : Symbol(Elem, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 9, 15))
>a : Symbol(a, Decl(jsxChildrenGenericContextualTypes.tsx, 9, 23))
>children : Symbol(children, Decl(jsxChildrenGenericContextualTypes.tsx, 9, 31))
>i : Symbol(i, Decl(jsxChildrenGenericContextualTypes.tsx, 9, 42))
>a : Symbol(a, Decl(jsxChildrenGenericContextualTypes.tsx, 9, 49))
const qq = <Elem prop={{a: "x"}}>{i => ({a: "z"})}</Elem>
>qq : Symbol(qq, Decl(jsxChildrenGenericContextualTypes.tsx, 10, 5))
>Elem : Symbol(Elem, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 10, 16))
>a : Symbol(a, Decl(jsxChildrenGenericContextualTypes.tsx, 10, 24))
>i : Symbol(i, Decl(jsxChildrenGenericContextualTypes.tsx, 10, 34))
>a : Symbol(a, Decl(jsxChildrenGenericContextualTypes.tsx, 10, 41))
>Elem : Symbol(Elem, Decl(jsxChildrenGenericContextualTypes.tsx, 7, 5))
interface LitProps<T> { prop: T, children: (x: this) => T }
>LitProps : Symbol(LitProps, Decl(jsxChildrenGenericContextualTypes.tsx, 10, 57))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 12, 19))
>prop : Symbol(LitProps.prop, Decl(jsxChildrenGenericContextualTypes.tsx, 12, 23))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 12, 19))
>children : Symbol(LitProps.children, Decl(jsxChildrenGenericContextualTypes.tsx, 12, 32))
>x : Symbol(x, Decl(jsxChildrenGenericContextualTypes.tsx, 12, 44))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 12, 19))
const ElemLit = <T extends string>(p: LitProps<T>) => <div></div>;
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 17))
>p : Symbol(p, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 35))
>LitProps : Symbol(LitProps, Decl(jsxChildrenGenericContextualTypes.tsx, 10, 57))
>T : Symbol(T, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 17))
>div : Symbol(JSX.IntrinsicElements, Decl(jsxChildrenGenericContextualTypes.tsx, 4, 43))
>div : Symbol(JSX.IntrinsicElements, Decl(jsxChildrenGenericContextualTypes.tsx, 4, 43))
ElemLit({prop: "x", children: () => "x"});
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 14, 9))
>children : Symbol(children, Decl(jsxChildrenGenericContextualTypes.tsx, 14, 19))
const j = <ElemLit prop="x" children={() => "x"} />
>j : Symbol(j, Decl(jsxChildrenGenericContextualTypes.tsx, 15, 5))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 15, 18))
>children : Symbol(children, Decl(jsxChildrenGenericContextualTypes.tsx, 15, 27))
const jj = <ElemLit prop="x">{() => "x"}</ElemLit>
>jj : Symbol(jj, Decl(jsxChildrenGenericContextualTypes.tsx, 16, 5))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 16, 19))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
// Should error
const arg = <ElemLit prop="x" children={p => "y"} />
>arg : Symbol(arg, Decl(jsxChildrenGenericContextualTypes.tsx, 19, 5))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 19, 20))
>children : Symbol(children, Decl(jsxChildrenGenericContextualTypes.tsx, 19, 29))
>p : Symbol(p, Decl(jsxChildrenGenericContextualTypes.tsx, 19, 40))
const argchild = <ElemLit prop="x">{p => "y"}</ElemLit>
>argchild : Symbol(argchild, Decl(jsxChildrenGenericContextualTypes.tsx, 20, 5))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 20, 25))
>p : Symbol(p, Decl(jsxChildrenGenericContextualTypes.tsx, 20, 36))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
const mismatched = <ElemLit prop="x">{() => 12}</ElemLit>
>mismatched : Symbol(mismatched, Decl(jsxChildrenGenericContextualTypes.tsx, 21, 5))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
>prop : Symbol(prop, Decl(jsxChildrenGenericContextualTypes.tsx, 21, 27))
>ElemLit : Symbol(ElemLit, Decl(jsxChildrenGenericContextualTypes.tsx, 13, 5))
|