62 lines
2.4 KiB
Text
62 lines
2.4 KiB
Text
=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/constructorFunctionTypeIsAssignableToBaseType2.ts ===
|
|
// the constructor function itself does not need to be a subtype of the base type constructor function
|
|
|
|
class Base {
|
|
>Base : Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
|
|
|
|
static foo: {
|
|
>foo : Symbol(Base.foo, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 2, 12))
|
|
|
|
bar: Object;
|
|
>bar : Symbol(bar, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 3, 17))
|
|
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
|
}
|
|
constructor(x: Object) {
|
|
>x : Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 6, 16))
|
|
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
|
}
|
|
}
|
|
|
|
class Derived extends Base {
|
|
>Derived : Symbol(Derived, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 8, 1))
|
|
>Base : Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
|
|
|
|
// ok
|
|
static foo: {
|
|
>foo : Symbol(Derived.foo, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 10, 28))
|
|
|
|
bar: number;
|
|
>bar : Symbol(bar, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 12, 17))
|
|
}
|
|
|
|
constructor(x: number) {
|
|
>x : Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 16, 16))
|
|
|
|
super(x);
|
|
>super : Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
|
|
>x : Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 16, 16))
|
|
}
|
|
}
|
|
|
|
class Derived2 extends Base {
|
|
>Derived2 : Symbol(Derived2, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 19, 1))
|
|
>Base : Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
|
|
|
|
static foo: {
|
|
>foo : Symbol(Derived2.foo, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 21, 29))
|
|
|
|
bar: number;
|
|
>bar : Symbol(bar, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 22, 17))
|
|
}
|
|
|
|
// ok, not enforcing assignability relation on this
|
|
constructor(x: any) {
|
|
>x : Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 27, 16))
|
|
|
|
super(x);
|
|
>super : Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
|
|
>x : Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 27, 16))
|
|
|
|
return 1;
|
|
}
|
|
}
|