TypeScript/tests/baselines/reference/unionTypeIndexSignature.symbols
2015-04-15 16:44:20 -07:00

66 lines
4 KiB
Plaintext

=== tests/cases/conformance/types/union/unionTypeIndexSignature.ts ===
var numOrDate: number | Date;
>numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
var anyVar: number;
>anyVar : Symbol(anyVar, Decl(unionTypeIndexSignature.ts, 1, 3))
// If each type in U has a string index signature,
// U has a string index signature of a union type of the types of the string index signatures from each type in U.
var unionOfDifferentReturnType: { [a: string]: number; } | { [a: string]: Date; };
>unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeIndexSignature.ts, 6, 3))
>a : Symbol(a, Decl(unionTypeIndexSignature.ts, 6, 35))
>a : Symbol(a, Decl(unionTypeIndexSignature.ts, 6, 62))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
numOrDate = unionOfDifferentReturnType["hello"]; // number | Date
>numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3))
>unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeIndexSignature.ts, 6, 3))
numOrDate = unionOfDifferentReturnType[10]; // number | Date
>numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3))
>unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeIndexSignature.ts, 6, 3))
var unionOfTypesWithAndWithoutStringSignature: { [a: string]: number; } | boolean;
>unionOfTypesWithAndWithoutStringSignature : Symbol(unionOfTypesWithAndWithoutStringSignature, Decl(unionTypeIndexSignature.ts, 10, 3))
>a : Symbol(a, Decl(unionTypeIndexSignature.ts, 10, 50))
anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any
>anyVar : Symbol(anyVar, Decl(unionTypeIndexSignature.ts, 1, 3))
>unionOfTypesWithAndWithoutStringSignature : Symbol(unionOfTypesWithAndWithoutStringSignature, Decl(unionTypeIndexSignature.ts, 10, 3))
anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any
>anyVar : Symbol(anyVar, Decl(unionTypeIndexSignature.ts, 1, 3))
>unionOfTypesWithAndWithoutStringSignature : Symbol(unionOfTypesWithAndWithoutStringSignature, Decl(unionTypeIndexSignature.ts, 10, 3))
// If each type in U has a numeric index signature,
// U has a numeric index signature of a union type of the types of the numeric index signatures from each type in U.
var unionOfDifferentReturnType1: { [a: number]: number; } | { [a: number]: Date; };
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeIndexSignature.ts, 16, 3))
>a : Symbol(a, Decl(unionTypeIndexSignature.ts, 16, 36))
>a : Symbol(a, Decl(unionTypeIndexSignature.ts, 16, 63))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
numOrDate = unionOfDifferentReturnType1["hello"]; // any
>numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3))
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeIndexSignature.ts, 16, 3))
numOrDate = unionOfDifferentReturnType1[10]; // number | Date
>numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3))
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeIndexSignature.ts, 16, 3))
var unionOfTypesWithAndWithoutStringSignature1: { [a: number]: number; } | boolean;
>unionOfTypesWithAndWithoutStringSignature1 : Symbol(unionOfTypesWithAndWithoutStringSignature1, Decl(unionTypeIndexSignature.ts, 20, 3))
>a : Symbol(a, Decl(unionTypeIndexSignature.ts, 20, 51))
anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any
>anyVar : Symbol(anyVar, Decl(unionTypeIndexSignature.ts, 1, 3))
>unionOfTypesWithAndWithoutStringSignature1 : Symbol(unionOfTypesWithAndWithoutStringSignature1, Decl(unionTypeIndexSignature.ts, 20, 3))
anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any
>anyVar : Symbol(anyVar, Decl(unionTypeIndexSignature.ts, 1, 3))
>unionOfTypesWithAndWithoutStringSignature1 : Symbol(unionOfTypesWithAndWithoutStringSignature1, Decl(unionTypeIndexSignature.ts, 20, 3))