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

35 lines
448 B
Plaintext

=== tests/cases/compiler/hidingIndexSignatures.ts ===
interface A {
>A : A
[a: string]: {};
>a : string
}
interface B extends A {
>B : B
>A : A
[a: string]: number; // Number is not a subtype of string. Should error.
>a : string
}
var b: B;
>b : B
>B : B
b[""]; // Should be number
>b[""] : number
>b : B
>"" : string
var a: A;
>a : A
>A : A
a[""]; // Should be {}
>a[""] : {}
>a : A
>"" : string