TypeScript/tests/baselines/reference/hidingIndexSignatures.types

35 lines
989 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/hidingIndexSignatures.ts ===
interface A {
2015-04-13 23:01:57 +02:00
>A : A, Symbol(A, Decl(hidingIndexSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
[a: string]: {};
2015-04-13 23:01:57 +02:00
>a : string, Symbol(a, Decl(hidingIndexSignatures.ts, 1, 5))
2014-08-15 23:33:16 +02:00
}
interface B extends A {
2015-04-13 23:01:57 +02:00
>B : B, Symbol(B, Decl(hidingIndexSignatures.ts, 2, 1))
>A : A, Symbol(A, Decl(hidingIndexSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
[a: string]: number; // Number is not a subtype of string. Should error.
2015-04-13 23:01:57 +02:00
>a : string, Symbol(a, Decl(hidingIndexSignatures.ts, 5, 5))
2014-08-15 23:33:16 +02:00
}
var b: B;
2015-04-13 23:01:57 +02:00
>b : B, Symbol(b, Decl(hidingIndexSignatures.ts, 8, 3))
>B : B, Symbol(B, Decl(hidingIndexSignatures.ts, 2, 1))
2014-08-15 23:33:16 +02:00
b[""]; // Should be number
>b[""] : number
2015-04-13 23:01:57 +02:00
>b : B, Symbol(b, Decl(hidingIndexSignatures.ts, 8, 3))
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00
var a: A;
2015-04-13 23:01:57 +02:00
>a : A, Symbol(a, Decl(hidingIndexSignatures.ts, 10, 3))
>A : A, Symbol(A, Decl(hidingIndexSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
a[""]; // Should be {}
>a[""] : {}
2015-04-13 23:01:57 +02:00
>a : A, Symbol(a, Decl(hidingIndexSignatures.ts, 10, 3))
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00