TypeScript/tests/baselines/reference/tsxUnionSpread.types
Wesley Wigham dd933f4413
Fix get symbol at location to behave correctly for parameter assignments and jsx attributes (#20706)
* Fix get symbol at location to behave correctly got parameter assignments and jsx attributes

* Handle all those edge cases that weren;t explicitly handled

* Fix part of bug WRT getTypeAtLocation and for loops

* Baseline corrections pursuant to #20710

* Restore jsdoc tag interpretation

* Clean up some code, revert fourslash tests

* Cleanup types used by PR feedback
2017-12-15 15:50:22 -08:00

75 lines
1.8 KiB
Plaintext

=== tests/cases/compiler/index.tsx ===
namespace JSX {
>JSX : any
export interface Element {}
>Element : Element
}
export type CatInfo = { type: 'Cat'; subType: string; };
>CatInfo : CatInfo
>type : "Cat"
>subType : string
export type DogInfo = { type: 'Dog'; };
>DogInfo : DogInfo
>type : "Dog"
export type AnimalInfo = CatInfo | DogInfo;
>AnimalInfo : AnimalInfo
>CatInfo : CatInfo
>DogInfo : DogInfo
function AnimalComponent(info: AnimalInfo): JSX.Element {
>AnimalComponent : (info: AnimalInfo) => JSX.Element
>info : AnimalInfo
>AnimalInfo : AnimalInfo
>JSX : any
>Element : JSX.Element
return undefined as any;
>undefined as any : any
>undefined : undefined
}
function getProps(): AnimalInfo {
>getProps : () => AnimalInfo
>AnimalInfo : AnimalInfo
// this may be from server or whatever ...
return { type: 'Cat', subType: 'Large' };
>{ type: 'Cat', subType: 'Large' } : { type: "Cat"; subType: string; }
>type : "Cat"
>'Cat' : "Cat"
>subType : string
>'Large' : "Large"
}
var props:AnimalInfo = getProps();
>props : AnimalInfo
>AnimalInfo : AnimalInfo
>getProps() : AnimalInfo
>getProps : () => AnimalInfo
var component = <AnimalComponent {...props} />
>component : any
><AnimalComponent {...props} /> : any
>AnimalComponent : (info: AnimalInfo) => JSX.Element
>props : AnimalInfo
var props2:AnimalInfo = { type: 'Cat', subType: 'Large' };
>props2 : AnimalInfo
>AnimalInfo : AnimalInfo
>{ type: 'Cat', subType: 'Large' } : { type: "Cat"; subType: string; }
>type : "Cat"
>'Cat' : "Cat"
>subType : string
>'Large' : "Large"
var component2 = <AnimalComponent {...props2} />
>component2 : any
><AnimalComponent {...props2} /> : any
>AnimalComponent : (info: AnimalInfo) => JSX.Element
>props2 : CatInfo