mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
52 lines
2.0 KiB
Plaintext
52 lines
2.0 KiB
Plaintext
//// [tests/cases/compiler/baseIndexSignatureResolution.ts] ////
|
|
|
|
=== baseIndexSignatureResolution.ts ===
|
|
class Base { private a: string; }
|
|
>Base : Symbol(Base, Decl(baseIndexSignatureResolution.ts, 0, 0))
|
|
>a : Symbol(Base.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(Derived.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();
|
|
*/
|