TypeScript/tests/baselines/reference/hidingIndexSignatures.types

35 lines
448 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/hidingIndexSignatures.ts ===
interface A {
>A : A
2014-08-15 23:33:16 +02:00
[a: string]: {};
>a : string
2014-08-15 23:33:16 +02:00
}
interface B extends A {
>B : B
>A : A
2014-08-15 23:33:16 +02:00
[a: string]: number; // Number is not a subtype of string. Should error.
>a : string
2014-08-15 23:33:16 +02:00
}
var b: B;
>b : B
>B : B
2014-08-15 23:33:16 +02:00
b[""]; // Should be number
>b[""] : number
>b : B
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00
var a: A;
>a : A
>A : A
2014-08-15 23:33:16 +02:00
a[""]; // Should be {}
>a[""] : {}
>a : A
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00