49 lines
1.9 KiB
Text
49 lines
1.9 KiB
Text
=== tests/cases/compiler/baseIndexSignatureResolution.ts ===
|
|
class Base { private a: string; }
|
|
>Base : Symbol(Base, Decl(baseIndexSignatureResolution.ts, 0, 0))
|
|
>a : Symbol(a, Decl(baseIndexSignatureResolution.ts, 0, 12))
|
|
|
|
class Derived extends Base { private b: string; }
|
|
>Derived : Symbol(Derived, Decl(baseIndexSignatureResolution.ts, 0, 33))
|
|
>Base : Symbol(Base, Decl(baseIndexSignatureResolution.ts, 0, 0))
|
|
>b : Symbol(b, Decl(baseIndexSignatureResolution.ts, 1, 28))
|
|
|
|
// Note - commmenting "extends Foo" prevents the error
|
|
interface Foo {
|
|
>Foo : Symbol(Foo, Decl(baseIndexSignatureResolution.ts, 1, 49))
|
|
|
|
[i: number]: Base;
|
|
>i : Symbol(i, Decl(baseIndexSignatureResolution.ts, 5, 5))
|
|
>Base : Symbol(Base, Decl(baseIndexSignatureResolution.ts, 0, 0))
|
|
}
|
|
interface FooOf<TBase extends Base> extends Foo {
|
|
>FooOf : Symbol(FooOf, Decl(baseIndexSignatureResolution.ts, 6, 1))
|
|
>TBase : Symbol(TBase, Decl(baseIndexSignatureResolution.ts, 7, 16))
|
|
>Base : Symbol(Base, Decl(baseIndexSignatureResolution.ts, 0, 0))
|
|
>Foo : Symbol(Foo, Decl(baseIndexSignatureResolution.ts, 1, 49))
|
|
|
|
[i: number]: TBase;
|
|
>i : Symbol(i, Decl(baseIndexSignatureResolution.ts, 8, 5))
|
|
>TBase : Symbol(TBase, Decl(baseIndexSignatureResolution.ts, 7, 16))
|
|
}
|
|
var x: FooOf<Derived> = null;
|
|
>x : Symbol(x, Decl(baseIndexSignatureResolution.ts, 10, 3))
|
|
>FooOf : Symbol(FooOf, Decl(baseIndexSignatureResolution.ts, 6, 1))
|
|
>Derived : Symbol(Derived, Decl(baseIndexSignatureResolution.ts, 0, 33))
|
|
|
|
var y: Derived = x[0];
|
|
>y : Symbol(y, Decl(baseIndexSignatureResolution.ts, 11, 3))
|
|
>Derived : Symbol(Derived, Decl(baseIndexSignatureResolution.ts, 0, 33))
|
|
>x : Symbol(x, Decl(baseIndexSignatureResolution.ts, 10, 3))
|
|
|
|
/*
|
|
// 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();
|
|
*/
|