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
|
=== tests/cases/compiler/index.tsx ===
namespace JSX {
>JSX : Symbol(JSX, Decl(index.tsx, 0, 0))
export interface Element {}
>Element : Symbol(Element, Decl(index.tsx, 0, 15))
}
export type CatInfo = { type: 'Cat'; subType: string; };
>CatInfo : Symbol(CatInfo, Decl(index.tsx, 2, 1))
>type : Symbol(type, Decl(index.tsx, 4, 23))
>subType : Symbol(subType, Decl(index.tsx, 4, 36))
export type DogInfo = { type: 'Dog'; };
>DogInfo : Symbol(DogInfo, Decl(index.tsx, 4, 56))
>type : Symbol(type, Decl(index.tsx, 5, 23))
export type AnimalInfo = CatInfo | DogInfo;
>AnimalInfo : Symbol(AnimalInfo, Decl(index.tsx, 5, 39))
>CatInfo : Symbol(CatInfo, Decl(index.tsx, 2, 1))
>DogInfo : Symbol(DogInfo, Decl(index.tsx, 4, 56))
function AnimalComponent(info: AnimalInfo): JSX.Element {
>AnimalComponent : Symbol(AnimalComponent, Decl(index.tsx, 6, 43))
>info : Symbol(info, Decl(index.tsx, 8, 25))
>AnimalInfo : Symbol(AnimalInfo, Decl(index.tsx, 5, 39))
>JSX : Symbol(JSX, Decl(index.tsx, 0, 0))
>Element : Symbol(JSX.Element, Decl(index.tsx, 0, 15))
return undefined as any;
>undefined : Symbol(undefined)
}
function getProps(): AnimalInfo {
>getProps : Symbol(getProps, Decl(index.tsx, 10, 1))
>AnimalInfo : Symbol(AnimalInfo, Decl(index.tsx, 5, 39))
// this may be from server or whatever ...
return { type: 'Cat', subType: 'Large' };
>type : Symbol(type, Decl(index.tsx, 14, 12))
>subType : Symbol(subType, Decl(index.tsx, 14, 25))
}
var props:AnimalInfo = getProps();
>props : Symbol(props, Decl(index.tsx, 17, 3))
>AnimalInfo : Symbol(AnimalInfo, Decl(index.tsx, 5, 39))
>getProps : Symbol(getProps, Decl(index.tsx, 10, 1))
var component = <AnimalComponent {...props} />
>component : Symbol(component, Decl(index.tsx, 18, 3))
>AnimalComponent : Symbol(AnimalComponent, Decl(index.tsx, 6, 43))
>props : Symbol(props, Decl(index.tsx, 17, 3))
var props2:AnimalInfo = { type: 'Cat', subType: 'Large' };
>props2 : Symbol(props2, Decl(index.tsx, 20, 3))
>AnimalInfo : Symbol(AnimalInfo, Decl(index.tsx, 5, 39))
>type : Symbol(type, Decl(index.tsx, 20, 25))
>subType : Symbol(subType, Decl(index.tsx, 20, 38))
var component2 = <AnimalComponent {...props2} />
>component2 : Symbol(component2, Decl(index.tsx, 21, 3))
>AnimalComponent : Symbol(AnimalComponent, Decl(index.tsx, 6, 43))
>props2 : Symbol(props2, Decl(index.tsx, 20, 3))
|