2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/baseIndexSignatureResolution.ts ===
|
|
|
|
class Base { private a: string; }
|
|
|
|
>Base : Base
|
|
|
|
>a : string
|
|
|
|
|
|
|
|
class Derived extends Base { private b: string; }
|
|
|
|
>Derived : Derived
|
|
|
|
>Base : Base
|
|
|
|
>b : string
|
|
|
|
|
|
|
|
// Note - commmenting "extends Foo" prevents the error
|
|
|
|
interface Foo {
|
|
|
|
>Foo : Foo
|
|
|
|
|
|
|
|
[i: number]: Base;
|
|
|
|
>i : number
|
|
|
|
>Base : Base
|
|
|
|
}
|
|
|
|
interface FooOf<TBase extends Base> extends Foo {
|
|
|
|
>FooOf : FooOf<TBase>
|
|
|
|
>TBase : TBase
|
|
|
|
>Base : Base
|
|
|
|
>Foo : Foo
|
|
|
|
|
|
|
|
[i: number]: TBase;
|
|
|
|
>i : number
|
|
|
|
>TBase : TBase
|
|
|
|
}
|
|
|
|
var x: FooOf<Derived> = null;
|
|
|
|
>x : FooOf<Derived>
|
2014-08-19 04:56:03 +02:00
|
|
|
>FooOf : FooOf<TBase>
|
2014-08-15 23:33:16 +02:00
|
|
|
>Derived : Derived
|
|
|
|
|
|
|
|
var y: Derived = x[0];
|
|
|
|
>y : Derived
|
|
|
|
>Derived : Derived
|
|
|
|
>x[0] : Derived
|
|
|
|
>x : FooOf<Derived>
|
|
|
|
|
|
|
|
/*
|
|
|
|
// Note - the equivalent for normal interface methods works fine:
|
|
|
|
interface A {
|
|
|
|
foo(): Base;
|
|
|
|
}
|
|
|
|
interface B<TBase extends Base> extends A {
|
|
|
|
foo(): TBase;
|
|
|
|
}
|
|
|
|
var b: B<Derived> = null;
|
|
|
|
var z: Derived = b.foo();
|
|
|
|
*/
|