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
|
=== tests/cases/compiler/jsxComponentTypeErrors.tsx ===
namespace JSX {
>JSX : Symbol(JSX, Decl(jsxComponentTypeErrors.tsx, 0, 0))
export interface Element {
>Element : Symbol(Element, Decl(jsxComponentTypeErrors.tsx, 0, 15))
type: 'element';
>type : Symbol(Element.type, Decl(jsxComponentTypeErrors.tsx, 1, 28))
}
export interface ElementClass {
>ElementClass : Symbol(ElementClass, Decl(jsxComponentTypeErrors.tsx, 3, 3))
type: 'element-class';
>type : Symbol(ElementClass.type, Decl(jsxComponentTypeErrors.tsx, 4, 33))
}
}
function FunctionComponent<T extends string>({type}: {type?: T}) {
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxComponentTypeErrors.tsx, 7, 1), Decl(jsxComponentTypeErrors.tsx, 13, 1))
>T : Symbol(T, Decl(jsxComponentTypeErrors.tsx, 9, 27))
>type : Symbol(type, Decl(jsxComponentTypeErrors.tsx, 9, 46))
>type : Symbol(type, Decl(jsxComponentTypeErrors.tsx, 9, 54))
>T : Symbol(T, Decl(jsxComponentTypeErrors.tsx, 9, 27))
return {
type
>type : Symbol(type, Decl(jsxComponentTypeErrors.tsx, 10, 10))
}
}
FunctionComponent.useThis = function() {
>FunctionComponent.useThis : Symbol(FunctionComponent.useThis, Decl(jsxComponentTypeErrors.tsx, 13, 1))
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxComponentTypeErrors.tsx, 7, 1), Decl(jsxComponentTypeErrors.tsx, 13, 1))
>useThis : Symbol(FunctionComponent.useThis, Decl(jsxComponentTypeErrors.tsx, 13, 1))
return <this type="foo" />;
>this : Symbol(FunctionComponent, Decl(jsxComponentTypeErrors.tsx, 7, 1), Decl(jsxComponentTypeErrors.tsx, 13, 1))
>type : Symbol(type, Decl(jsxComponentTypeErrors.tsx, 15, 14))
}
class ClassComponent {
>ClassComponent : Symbol(ClassComponent, Decl(jsxComponentTypeErrors.tsx, 16, 1))
type = 'string';
>type : Symbol(ClassComponent.type, Decl(jsxComponentTypeErrors.tsx, 18, 22))
}
const MixedComponent = Math.random() ? FunctionComponent : ClassComponent;
>MixedComponent : Symbol(MixedComponent, Decl(jsxComponentTypeErrors.tsx, 22, 5))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxComponentTypeErrors.tsx, 7, 1), Decl(jsxComponentTypeErrors.tsx, 13, 1))
>ClassComponent : Symbol(ClassComponent, Decl(jsxComponentTypeErrors.tsx, 16, 1))
const elem1 = <FunctionComponent type="abc" />;
>elem1 : Symbol(elem1, Decl(jsxComponentTypeErrors.tsx, 24, 5))
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxComponentTypeErrors.tsx, 7, 1), Decl(jsxComponentTypeErrors.tsx, 13, 1))
>type : Symbol(type, Decl(jsxComponentTypeErrors.tsx, 24, 32))
const elem2 = <FunctionComponent<"abc"> />;
>elem2 : Symbol(elem2, Decl(jsxComponentTypeErrors.tsx, 25, 5))
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxComponentTypeErrors.tsx, 7, 1), Decl(jsxComponentTypeErrors.tsx, 13, 1))
const elem3 = <ClassComponent />;
>elem3 : Symbol(elem3, Decl(jsxComponentTypeErrors.tsx, 26, 5))
>ClassComponent : Symbol(ClassComponent, Decl(jsxComponentTypeErrors.tsx, 16, 1))
const elem4 = <MixedComponent />;
>elem4 : Symbol(elem4, Decl(jsxComponentTypeErrors.tsx, 27, 5))
>MixedComponent : Symbol(MixedComponent, Decl(jsxComponentTypeErrors.tsx, 22, 5))
const obj = {
>obj : Symbol(obj, Decl(jsxComponentTypeErrors.tsx, 29, 5))
MemberFunctionComponent() {
>MemberFunctionComponent : Symbol(MemberFunctionComponent, Decl(jsxComponentTypeErrors.tsx, 29, 13))
return {};
},
MemberClassComponent: class {},
>MemberClassComponent : Symbol(MemberClassComponent, Decl(jsxComponentTypeErrors.tsx, 32, 4))
};
const elem5 = <obj.MemberFunctionComponent />;
>elem5 : Symbol(elem5, Decl(jsxComponentTypeErrors.tsx, 36, 5))
>obj.MemberFunctionComponent : Symbol(MemberFunctionComponent, Decl(jsxComponentTypeErrors.tsx, 29, 13))
>obj : Symbol(obj, Decl(jsxComponentTypeErrors.tsx, 29, 5))
>MemberFunctionComponent : Symbol(MemberFunctionComponent, Decl(jsxComponentTypeErrors.tsx, 29, 13))
const elem6 = <obj. MemberClassComponent />;
>elem6 : Symbol(elem6, Decl(jsxComponentTypeErrors.tsx, 37, 5))
>obj. MemberClassComponent : Symbol(MemberClassComponent, Decl(jsxComponentTypeErrors.tsx, 32, 4))
>obj : Symbol(obj, Decl(jsxComponentTypeErrors.tsx, 29, 5))
>MemberClassComponent : Symbol(MemberClassComponent, Decl(jsxComponentTypeErrors.tsx, 32, 4))
|