2014-11-04 22:33:43 +01:00
=== tests/cases/conformance/types/union/contextualTypeWithUnionTypeMembers.ts ===
//When used as a contextual type, a union type U has those members that are present in any of
// its constituent types, with types that are unions of the respective members in the constituent types.
interface I1<T> {
2015-04-13 22:54:22 +02:00
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
>T : T, Symbol(T,Decl(contextualTypeWithUnionTypeMembers.ts,2,13))
2014-11-04 22:33:43 +01:00
commonMethodType(a: string): string;
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,2,17))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,3,21))
2014-11-04 22:33:43 +01:00
commonPropertyType: string;
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,3,40))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter(a: T): T;
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: T) => T, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,4,31))
>a : T, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,5,34))
>T : T, Symbol(T,Decl(contextualTypeWithUnionTypeMembers.ts,2,13))
>T : T, Symbol(T,Decl(contextualTypeWithUnionTypeMembers.ts,2,13))
2014-11-04 22:33:43 +01:00
methodOnlyInI1(a: string): string;
2015-04-13 22:54:22 +02:00
>methodOnlyInI1 : (a: string) => string, Symbol(methodOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,5,43))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,7,19))
2014-11-04 22:33:43 +01:00
propertyOnlyInI1: string;
2015-04-13 22:54:22 +02:00
>propertyOnlyInI1 : string, Symbol(propertyOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,7,38))
2014-11-04 22:33:43 +01:00
}
interface I2<T> {
2015-04-13 22:54:22 +02:00
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
>T : T, Symbol(T,Decl(contextualTypeWithUnionTypeMembers.ts,10,13))
2014-11-04 22:33:43 +01:00
commonMethodType(a: string): string;
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,10,17))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,11,21))
2014-11-04 22:33:43 +01:00
commonPropertyType: string;
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,11,40))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter(a: T): T;
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: T) => T, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,12,31))
>a : T, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,13,34))
>T : T, Symbol(T,Decl(contextualTypeWithUnionTypeMembers.ts,10,13))
>T : T, Symbol(T,Decl(contextualTypeWithUnionTypeMembers.ts,10,13))
2014-11-04 22:33:43 +01:00
methodOnlyInI2(a: string): string;
2015-04-13 22:54:22 +02:00
>methodOnlyInI2 : (a: string) => string, Symbol(methodOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,13,43))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,15,19))
2014-11-04 22:33:43 +01:00
propertyOnlyInI2: string;
2015-04-13 22:54:22 +02:00
>propertyOnlyInI2 : string, Symbol(propertyOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,15,38))
2014-11-04 22:33:43 +01:00
}
// Let S be the set of types in U that has a property P.
// If S is not empty, U has a property P of a union type of the types of P from each type in S.
var i1: I1<number>;
2015-04-13 22:54:22 +02:00
>i1 : I1<number>, Symbol(i1,Decl(contextualTypeWithUnionTypeMembers.ts,21,3))
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
2014-11-04 22:33:43 +01:00
var i2: I2<number>;
2015-04-13 22:54:22 +02:00
>i2 : I2<number>, Symbol(i2,Decl(contextualTypeWithUnionTypeMembers.ts,22,3))
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
2014-11-04 22:33:43 +01:00
var i1Ori2: I1<number> | I2<number> = i1;
2015-04-13 22:54:22 +02:00
>i1Ori2 : I1<number> | I2<number>, Symbol(i1Ori2,Decl(contextualTypeWithUnionTypeMembers.ts,23,3),Decl(contextualTypeWithUnionTypeMembers.ts,24,3),Decl(contextualTypeWithUnionTypeMembers.ts,25,3),Decl(contextualTypeWithUnionTypeMembers.ts,33,3),Decl(contextualTypeWithUnionTypeMembers.ts,41,3))
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
>i1 : I1<number>, Symbol(i1,Decl(contextualTypeWithUnionTypeMembers.ts,21,3))
2014-11-04 22:33:43 +01:00
var i1Ori2: I1<number> | I2<number> = i2;
2015-04-13 22:54:22 +02:00
>i1Ori2 : I1<number> | I2<number>, Symbol(i1Ori2,Decl(contextualTypeWithUnionTypeMembers.ts,23,3),Decl(contextualTypeWithUnionTypeMembers.ts,24,3),Decl(contextualTypeWithUnionTypeMembers.ts,25,3),Decl(contextualTypeWithUnionTypeMembers.ts,33,3),Decl(contextualTypeWithUnionTypeMembers.ts,41,3))
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
>i2 : I2<number>, Symbol(i2,Decl(contextualTypeWithUnionTypeMembers.ts,22,3))
2014-11-04 22:33:43 +01:00
var i1Ori2: I1<number> | I2<number> = { // Like i1
2015-04-13 22:54:22 +02:00
>i1Ori2 : I1<number> | I2<number>, Symbol(i1Ori2,Decl(contextualTypeWithUnionTypeMembers.ts,23,3),Decl(contextualTypeWithUnionTypeMembers.ts,24,3),Decl(contextualTypeWithUnionTypeMembers.ts,25,3),Decl(contextualTypeWithUnionTypeMembers.ts,33,3),Decl(contextualTypeWithUnionTypeMembers.ts,41,3))
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
2014-11-04 22:33:43 +01:00
>{ // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello",} : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; }
commonPropertyType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,25,39))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
commonMethodType: a=> a,
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,26,32))
2014-11-04 22:33:43 +01:00
>a=> a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,27,21))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,27,21))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter: a => a,
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: number) => number, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,27,28))
2014-11-04 22:33:43 +01:00
>a => a : (a: number) => number
2015-04-13 22:54:22 +02:00
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,28,34))
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,28,34))
2014-11-04 22:33:43 +01:00
methodOnlyInI1: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI1 : (a: string) => string, Symbol(methodOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,28,42))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,30,19))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,30,19))
2014-11-04 22:33:43 +01:00
propertyOnlyInI1: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI1 : string, Symbol(propertyOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,30,27))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
};
var i1Ori2: I1<number> | I2<number> = { // Like i2
2015-04-13 22:54:22 +02:00
>i1Ori2 : I1<number> | I2<number>, Symbol(i1Ori2,Decl(contextualTypeWithUnionTypeMembers.ts,23,3),Decl(contextualTypeWithUnionTypeMembers.ts,24,3),Decl(contextualTypeWithUnionTypeMembers.ts,25,3),Decl(contextualTypeWithUnionTypeMembers.ts,33,3),Decl(contextualTypeWithUnionTypeMembers.ts,41,3))
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
2014-11-04 22:33:43 +01:00
>{ // Like i2 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI2: a => a, propertyOnlyInI2: "Hello",} : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI2: (a: string) => string; propertyOnlyInI2: string; }
commonPropertyType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,33,39))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
commonMethodType: a=> a,
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,34,32))
2014-11-04 22:33:43 +01:00
>a=> a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,35,21))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,35,21))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter: a => a,
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: number) => number, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,35,28))
2014-11-04 22:33:43 +01:00
>a => a : (a: number) => number
2015-04-13 22:54:22 +02:00
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,36,34))
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,36,34))
2014-11-04 22:33:43 +01:00
methodOnlyInI2: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI2 : (a: string) => string, Symbol(methodOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,36,42))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,38,19))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,38,19))
2014-11-04 22:33:43 +01:00
propertyOnlyInI2: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI2 : string, Symbol(propertyOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,38,27))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
};
var i1Ori2: I1<number> | I2<number> = { // Like i1 and i2 both
2015-04-13 22:54:22 +02:00
>i1Ori2 : I1<number> | I2<number>, Symbol(i1Ori2,Decl(contextualTypeWithUnionTypeMembers.ts,23,3),Decl(contextualTypeWithUnionTypeMembers.ts,24,3),Decl(contextualTypeWithUnionTypeMembers.ts,25,3),Decl(contextualTypeWithUnionTypeMembers.ts,33,3),Decl(contextualTypeWithUnionTypeMembers.ts,41,3))
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
2014-11-04 22:33:43 +01:00
>{ // Like i1 and i2 both commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", methodOnlyInI2: a => a, propertyOnlyInI2: "Hello",} : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; methodOnlyInI2: (a: string) => string; propertyOnlyInI2: string; }
commonPropertyType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,41,39))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
commonMethodType: a=> a,
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,42,32))
2014-11-04 22:33:43 +01:00
>a=> a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,43,21))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,43,21))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter: a => a,
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: number) => number, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,43,28))
2014-11-04 22:33:43 +01:00
>a => a : (a: number) => number
2015-04-13 22:54:22 +02:00
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,44,34))
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,44,34))
2014-11-04 22:33:43 +01:00
methodOnlyInI1: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI1 : (a: string) => string, Symbol(methodOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,44,42))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,45,19))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,45,19))
2014-11-04 22:33:43 +01:00
propertyOnlyInI1: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI1 : string, Symbol(propertyOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,45,27))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
methodOnlyInI2: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI2 : (a: string) => string, Symbol(methodOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,46,30))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,47,19))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,47,19))
2014-11-04 22:33:43 +01:00
propertyOnlyInI2: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI2 : string, Symbol(propertyOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,47,27))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
};
var arrayI1OrI2: Array<I1<number> | I2<number>> = [i1, i2, { // Like i1
2015-04-13 22:54:22 +02:00
>arrayI1OrI2 : (I1<number> | I2<number>)[], Symbol(arrayI1OrI2,Decl(contextualTypeWithUnionTypeMembers.ts,51,3))
>Array : T[], Symbol(Array,Decl(lib.d.ts,1000,23),Decl(lib.d.ts,1171,11))
>I1 : I1<T>, Symbol(I1,Decl(contextualTypeWithUnionTypeMembers.ts,0,0))
>I2 : I2<T>, Symbol(I2,Decl(contextualTypeWithUnionTypeMembers.ts,9,1))
2014-11-04 22:33:43 +01:00
>[i1, i2, { // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", }, { // Like i2 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }, { // Like i1 and i2 both commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }] : (I1<number> | I2<number>)[]
2015-04-13 22:54:22 +02:00
>i1 : I1<number>, Symbol(i1,Decl(contextualTypeWithUnionTypeMembers.ts,21,3))
>i2 : I2<number>, Symbol(i2,Decl(contextualTypeWithUnionTypeMembers.ts,22,3))
2014-11-04 22:33:43 +01:00
>{ // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", } : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; }
commonPropertyType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,51,60))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
commonMethodType: a=> a,
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,52,36))
2014-11-04 22:33:43 +01:00
>a=> a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,53,25))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,53,25))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter: a => a,
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: number) => number, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,53,32))
2014-11-04 22:33:43 +01:00
>a => a : (a: number) => number
2015-04-13 22:54:22 +02:00
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,54,38))
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,54,38))
2014-11-04 22:33:43 +01:00
methodOnlyInI1: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI1 : (a: string) => string, Symbol(methodOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,54,46))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,56,23))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,56,23))
2014-11-04 22:33:43 +01:00
propertyOnlyInI1: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI1 : string, Symbol(propertyOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,56,31))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
},
{ // Like i2
>{ // Like i2 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", } : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI2: (a: string) => string; propertyOnlyInI2: string; }
commonPropertyType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,59,5))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
commonMethodType: a=> a,
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,60,36))
2014-11-04 22:33:43 +01:00
>a=> a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,61,25))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,61,25))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter: a => a,
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: number) => number, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,61,32))
2014-11-04 22:33:43 +01:00
>a => a : (a: number) => number
2015-04-13 22:54:22 +02:00
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,62,38))
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,62,38))
2014-11-04 22:33:43 +01:00
methodOnlyInI2: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI2 : (a: string) => string, Symbol(methodOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,62,46))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,64,23))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,64,23))
2014-11-04 22:33:43 +01:00
propertyOnlyInI2: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI2 : string, Symbol(propertyOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,64,31))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
}, { // Like i1 and i2 both
>{ // Like i1 and i2 both commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", } : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; methodOnlyInI2: (a: string) => string; propertyOnlyInI2: string; }
commonPropertyType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyType : string, Symbol(commonPropertyType,Decl(contextualTypeWithUnionTypeMembers.ts,66,8))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
commonMethodType: a=> a,
2015-04-13 22:54:22 +02:00
>commonMethodType : (a: string) => string, Symbol(commonMethodType,Decl(contextualTypeWithUnionTypeMembers.ts,67,36))
2014-11-04 22:33:43 +01:00
>a=> a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,68,25))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,68,25))
2014-11-04 22:33:43 +01:00
commonMethodWithTypeParameter: a => a,
2015-04-13 22:54:22 +02:00
>commonMethodWithTypeParameter : (a: number) => number, Symbol(commonMethodWithTypeParameter,Decl(contextualTypeWithUnionTypeMembers.ts,68,32))
2014-11-04 22:33:43 +01:00
>a => a : (a: number) => number
2015-04-13 22:54:22 +02:00
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,69,38))
>a : number, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,69,38))
2014-11-04 22:33:43 +01:00
methodOnlyInI1: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI1 : (a: string) => string, Symbol(methodOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,69,46))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,70,23))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,70,23))
2014-11-04 22:33:43 +01:00
propertyOnlyInI1: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI1 : string, Symbol(propertyOnlyInI1,Decl(contextualTypeWithUnionTypeMembers.ts,70,31))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
methodOnlyInI2: a => a,
2015-04-13 22:54:22 +02:00
>methodOnlyInI2 : (a: string) => string, Symbol(methodOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,71,34))
2014-11-04 22:33:43 +01:00
>a => a : (a: string) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,72,23))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,72,23))
2014-11-04 22:33:43 +01:00
propertyOnlyInI2: "Hello",
2015-04-13 22:54:22 +02:00
>propertyOnlyInI2 : string, Symbol(propertyOnlyInI2,Decl(contextualTypeWithUnionTypeMembers.ts,72,31))
2015-04-13 21:36:11 +02:00
>"Hello" : string
2014-11-04 22:33:43 +01:00
}];
interface I11 {
2015-04-13 22:54:22 +02:00
>I11 : I11, Symbol(I11,Decl(contextualTypeWithUnionTypeMembers.ts,74,7))
2014-11-04 22:33:43 +01:00
commonMethodDifferentReturnType(a: string, b: number): string;
2015-04-13 22:54:22 +02:00
>commonMethodDifferentReturnType : (a: string, b: number) => string, Symbol(commonMethodDifferentReturnType,Decl(contextualTypeWithUnionTypeMembers.ts,76,15))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,77,36))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,77,46))
2014-11-04 22:33:43 +01:00
commonPropertyDifferentType: string;
2015-04-13 22:54:22 +02:00
>commonPropertyDifferentType : string, Symbol(commonPropertyDifferentType,Decl(contextualTypeWithUnionTypeMembers.ts,77,66))
2014-11-04 22:33:43 +01:00
}
interface I21 {
2015-04-13 22:54:22 +02:00
>I21 : I21, Symbol(I21,Decl(contextualTypeWithUnionTypeMembers.ts,79,1))
2014-11-04 22:33:43 +01:00
commonMethodDifferentReturnType(a: string, b: number): number;
2015-04-13 22:54:22 +02:00
>commonMethodDifferentReturnType : (a: string, b: number) => number, Symbol(commonMethodDifferentReturnType,Decl(contextualTypeWithUnionTypeMembers.ts,80,15))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,81,36))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,81,46))
2014-11-04 22:33:43 +01:00
commonPropertyDifferentType: number;
2015-04-13 22:54:22 +02:00
>commonPropertyDifferentType : number, Symbol(commonPropertyDifferentType,Decl(contextualTypeWithUnionTypeMembers.ts,81,66))
2014-11-04 22:33:43 +01:00
}
var i11: I11;
2015-04-13 22:54:22 +02:00
>i11 : I11, Symbol(i11,Decl(contextualTypeWithUnionTypeMembers.ts,84,3))
>I11 : I11, Symbol(I11,Decl(contextualTypeWithUnionTypeMembers.ts,74,7))
2014-11-04 22:33:43 +01:00
var i21: I21;
2015-04-13 22:54:22 +02:00
>i21 : I21, Symbol(i21,Decl(contextualTypeWithUnionTypeMembers.ts,85,3))
>I21 : I21, Symbol(I21,Decl(contextualTypeWithUnionTypeMembers.ts,79,1))
2014-11-04 22:33:43 +01:00
var i11Ori21: I11 | I21 = i11;
2015-04-13 22:54:22 +02:00
>i11Ori21 : I11 | I21, Symbol(i11Ori21,Decl(contextualTypeWithUnionTypeMembers.ts,86,3),Decl(contextualTypeWithUnionTypeMembers.ts,87,3),Decl(contextualTypeWithUnionTypeMembers.ts,88,3),Decl(contextualTypeWithUnionTypeMembers.ts,96,3))
>I11 : I11, Symbol(I11,Decl(contextualTypeWithUnionTypeMembers.ts,74,7))
>I21 : I21, Symbol(I21,Decl(contextualTypeWithUnionTypeMembers.ts,79,1))
>i11 : I11, Symbol(i11,Decl(contextualTypeWithUnionTypeMembers.ts,84,3))
2014-11-04 22:33:43 +01:00
var i11Ori21: I11 | I21 = i21;
2015-04-13 22:54:22 +02:00
>i11Ori21 : I11 | I21, Symbol(i11Ori21,Decl(contextualTypeWithUnionTypeMembers.ts,86,3),Decl(contextualTypeWithUnionTypeMembers.ts,87,3),Decl(contextualTypeWithUnionTypeMembers.ts,88,3),Decl(contextualTypeWithUnionTypeMembers.ts,96,3))
>I11 : I11, Symbol(I11,Decl(contextualTypeWithUnionTypeMembers.ts,74,7))
>I21 : I21, Symbol(I21,Decl(contextualTypeWithUnionTypeMembers.ts,79,1))
>i21 : I21, Symbol(i21,Decl(contextualTypeWithUnionTypeMembers.ts,85,3))
2014-11-04 22:33:43 +01:00
var i11Ori21: I11 | I21 = {
2015-04-13 22:54:22 +02:00
>i11Ori21 : I11 | I21, Symbol(i11Ori21,Decl(contextualTypeWithUnionTypeMembers.ts,86,3),Decl(contextualTypeWithUnionTypeMembers.ts,87,3),Decl(contextualTypeWithUnionTypeMembers.ts,88,3),Decl(contextualTypeWithUnionTypeMembers.ts,96,3))
>I11 : I11, Symbol(I11,Decl(contextualTypeWithUnionTypeMembers.ts,74,7))
>I21 : I21, Symbol(I21,Decl(contextualTypeWithUnionTypeMembers.ts,79,1))
2014-11-04 23:49:15 +01:00
>{ // Like i1 commonMethodDifferentReturnType: (a, b) => { var z = a.charAt(b); return z; }, commonPropertyDifferentType: "hello", } : { commonMethodDifferentReturnType: (a: string, b: number) => string; commonPropertyDifferentType: string; }
2014-11-04 22:33:43 +01:00
// Like i1
commonMethodDifferentReturnType: (a, b) => {
2015-04-13 22:54:22 +02:00
>commonMethodDifferentReturnType : (a: string, b: number) => string, Symbol(commonMethodDifferentReturnType,Decl(contextualTypeWithUnionTypeMembers.ts,88,27))
2014-11-04 23:49:15 +01:00
>(a, b) => { var z = a.charAt(b); return z; } : (a: string, b: number) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,90,38))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,90,40))
2014-11-04 22:33:43 +01:00
var z = a.charAt(b);
2015-04-13 22:54:22 +02:00
>z : string, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,91,11))
2014-11-04 23:49:15 +01:00
>a.charAt(b) : string
2015-04-13 22:54:22 +02:00
>a.charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,90,38))
>charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,90,40))
2014-11-04 22:33:43 +01:00
return z;
2015-04-13 22:54:22 +02:00
>z : string, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,91,11))
2014-11-04 22:33:43 +01:00
},
commonPropertyDifferentType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyDifferentType : string, Symbol(commonPropertyDifferentType,Decl(contextualTypeWithUnionTypeMembers.ts,93,6))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
};
var i11Ori21: I11 | I21 = {
2015-04-13 22:54:22 +02:00
>i11Ori21 : I11 | I21, Symbol(i11Ori21,Decl(contextualTypeWithUnionTypeMembers.ts,86,3),Decl(contextualTypeWithUnionTypeMembers.ts,87,3),Decl(contextualTypeWithUnionTypeMembers.ts,88,3),Decl(contextualTypeWithUnionTypeMembers.ts,96,3))
>I11 : I11, Symbol(I11,Decl(contextualTypeWithUnionTypeMembers.ts,74,7))
>I21 : I21, Symbol(I21,Decl(contextualTypeWithUnionTypeMembers.ts,79,1))
2014-11-04 23:49:15 +01:00
>{ // Like i2 commonMethodDifferentReturnType: (a, b) => { var z = a.charCodeAt(b); return z; }, commonPropertyDifferentType: 10,} : { commonMethodDifferentReturnType: (a: string, b: number) => number; commonPropertyDifferentType: number; }
2014-11-04 22:33:43 +01:00
// Like i2
commonMethodDifferentReturnType: (a, b) => {
2015-04-13 22:54:22 +02:00
>commonMethodDifferentReturnType : (a: string, b: number) => number, Symbol(commonMethodDifferentReturnType,Decl(contextualTypeWithUnionTypeMembers.ts,96,27))
2014-11-04 23:49:15 +01:00
>(a, b) => { var z = a.charCodeAt(b); return z; } : (a: string, b: number) => number
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,98,38))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,98,40))
2014-11-04 22:33:43 +01:00
var z = a.charCodeAt(b);
2015-04-13 22:54:22 +02:00
>z : number, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,99,11))
2014-11-04 23:49:15 +01:00
>a.charCodeAt(b) : number
2015-04-13 22:54:22 +02:00
>a.charCodeAt : (index: number) => number, Symbol(String.charCodeAt,Decl(lib.d.ts,285,32))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,98,38))
>charCodeAt : (index: number) => number, Symbol(String.charCodeAt,Decl(lib.d.ts,285,32))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,98,40))
2014-11-04 22:33:43 +01:00
return z;
2015-04-13 22:54:22 +02:00
>z : number, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,99,11))
2014-11-04 22:33:43 +01:00
},
commonPropertyDifferentType: 10,
2015-04-13 22:54:22 +02:00
>commonPropertyDifferentType : number, Symbol(commonPropertyDifferentType,Decl(contextualTypeWithUnionTypeMembers.ts,101,6))
2015-04-13 21:36:11 +02:00
>10 : number
2014-11-04 22:33:43 +01:00
};
var arrayOrI11OrI21: Array<I11 | I21> = [i11, i21, i11 || i21, {
2015-04-13 22:54:22 +02:00
>arrayOrI11OrI21 : (I11 | I21)[], Symbol(arrayOrI11OrI21,Decl(contextualTypeWithUnionTypeMembers.ts,104,3))
>Array : T[], Symbol(Array,Decl(lib.d.ts,1000,23),Decl(lib.d.ts,1171,11))
>I11 : I11, Symbol(I11,Decl(contextualTypeWithUnionTypeMembers.ts,74,7))
>I21 : I21, Symbol(I21,Decl(contextualTypeWithUnionTypeMembers.ts,79,1))
2014-11-04 23:49:15 +01:00
>[i11, i21, i11 || i21, { // Like i1 commonMethodDifferentReturnType: (a, b) => { var z = a.charAt(b); return z; }, commonPropertyDifferentType: "hello", }, { // Like i2 commonMethodDifferentReturnType: (a, b) => { var z = a.charCodeAt(b); return z; }, commonPropertyDifferentType: 10, }] : (I11 | I21)[]
2015-04-13 22:54:22 +02:00
>i11 : I11, Symbol(i11,Decl(contextualTypeWithUnionTypeMembers.ts,84,3))
>i21 : I21, Symbol(i21,Decl(contextualTypeWithUnionTypeMembers.ts,85,3))
2014-11-04 22:33:43 +01:00
>i11 || i21 : I11 | I21
2015-04-13 22:54:22 +02:00
>i11 : I11, Symbol(i11,Decl(contextualTypeWithUnionTypeMembers.ts,84,3))
>i21 : I21, Symbol(i21,Decl(contextualTypeWithUnionTypeMembers.ts,85,3))
2014-11-04 23:49:15 +01:00
>{ // Like i1 commonMethodDifferentReturnType: (a, b) => { var z = a.charAt(b); return z; }, commonPropertyDifferentType: "hello", } : { commonMethodDifferentReturnType: (a: string, b: number) => string; commonPropertyDifferentType: string; }
2014-11-04 22:33:43 +01:00
// Like i1
commonMethodDifferentReturnType: (a, b) => {
2015-04-13 22:54:22 +02:00
>commonMethodDifferentReturnType : (a: string, b: number) => string, Symbol(commonMethodDifferentReturnType,Decl(contextualTypeWithUnionTypeMembers.ts,104,64))
2014-11-04 23:49:15 +01:00
>(a, b) => { var z = a.charAt(b); return z; } : (a: string, b: number) => string
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,106,42))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,106,44))
2014-11-04 22:33:43 +01:00
var z = a.charAt(b);
2015-04-13 22:54:22 +02:00
>z : string, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,107,15))
2014-11-04 23:49:15 +01:00
>a.charAt(b) : string
2015-04-13 22:54:22 +02:00
>a.charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,106,42))
>charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,106,44))
2014-11-04 22:33:43 +01:00
return z;
2015-04-13 22:54:22 +02:00
>z : string, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,107,15))
2014-11-04 22:33:43 +01:00
},
commonPropertyDifferentType: "hello",
2015-04-13 22:54:22 +02:00
>commonPropertyDifferentType : string, Symbol(commonPropertyDifferentType,Decl(contextualTypeWithUnionTypeMembers.ts,109,10))
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-11-04 22:33:43 +01:00
}, {
2014-11-04 23:49:15 +01:00
>{ // Like i2 commonMethodDifferentReturnType: (a, b) => { var z = a.charCodeAt(b); return z; }, commonPropertyDifferentType: 10, } : { commonMethodDifferentReturnType: (a: string, b: number) => number; commonPropertyDifferentType: number; }
2014-11-04 22:33:43 +01:00
// Like i2
commonMethodDifferentReturnType: (a, b) => {
2015-04-13 22:54:22 +02:00
>commonMethodDifferentReturnType : (a: string, b: number) => number, Symbol(commonMethodDifferentReturnType,Decl(contextualTypeWithUnionTypeMembers.ts,111,8))
2014-11-04 23:49:15 +01:00
>(a, b) => { var z = a.charCodeAt(b); return z; } : (a: string, b: number) => number
2015-04-13 22:54:22 +02:00
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,113,42))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,113,44))
2014-11-04 22:33:43 +01:00
var z = a.charCodeAt(b);
2015-04-13 22:54:22 +02:00
>z : number, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,114,15))
2014-11-04 23:49:15 +01:00
>a.charCodeAt(b) : number
2015-04-13 22:54:22 +02:00
>a.charCodeAt : (index: number) => number, Symbol(String.charCodeAt,Decl(lib.d.ts,285,32))
>a : string, Symbol(a,Decl(contextualTypeWithUnionTypeMembers.ts,113,42))
>charCodeAt : (index: number) => number, Symbol(String.charCodeAt,Decl(lib.d.ts,285,32))
>b : number, Symbol(b,Decl(contextualTypeWithUnionTypeMembers.ts,113,44))
2014-11-04 22:33:43 +01:00
return z;
2015-04-13 22:54:22 +02:00
>z : number, Symbol(z,Decl(contextualTypeWithUnionTypeMembers.ts,114,15))
2014-11-04 22:33:43 +01:00
},
commonPropertyDifferentType: 10,
2015-04-13 22:54:22 +02:00
>commonPropertyDifferentType : number, Symbol(commonPropertyDifferentType,Decl(contextualTypeWithUnionTypeMembers.ts,116,10))
2015-04-13 21:36:11 +02:00
>10 : number
2014-11-04 22:33:43 +01:00
}];