TypeScript/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.types

66 lines
2.6 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== 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 {
2015-04-13 23:01:57 +02:00
>Base : Base, Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
2014-08-15 23:33:16 +02:00
static foo: {
2015-04-13 23:01:57 +02:00
>foo : { bar: Object; }, Symbol(Base.foo, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 2, 12))
2014-08-15 23:33:16 +02:00
bar: Object;
2015-04-13 23:01:57 +02:00
>bar : Object, Symbol(bar, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 3, 17))
>Object : Object, Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
2014-08-15 23:33:16 +02:00
}
constructor(x: Object) {
2015-04-13 23:01:57 +02:00
>x : Object, Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 6, 16))
>Object : Object, Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
2014-08-15 23:33:16 +02:00
}
}
class Derived extends Base {
2015-04-13 23:01:57 +02:00
>Derived : Derived, Symbol(Derived, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 8, 1))
>Base : Base, Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
2014-08-15 23:33:16 +02:00
// ok
static foo: {
2015-04-13 23:01:57 +02:00
>foo : { bar: number; }, Symbol(Derived.foo, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 10, 28))
2014-08-15 23:33:16 +02:00
bar: number;
2015-04-13 23:01:57 +02:00
>bar : number, Symbol(bar, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 12, 17))
2014-08-15 23:33:16 +02:00
}
constructor(x: number) {
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 16, 16))
2014-08-15 23:33:16 +02:00
super(x);
>super(x) : void
2015-04-13 23:01:57 +02:00
>super : typeof Base, Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
>x : number, Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 16, 16))
2014-08-15 23:33:16 +02:00
}
}
class Derived2 extends Base {
2015-04-13 23:01:57 +02:00
>Derived2 : Derived2, Symbol(Derived2, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 19, 1))
>Base : Base, Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
2014-08-15 23:33:16 +02:00
static foo: {
2015-04-13 23:01:57 +02:00
>foo : { bar: number; }, Symbol(Derived2.foo, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 21, 29))
2014-08-15 23:33:16 +02:00
bar: number;
2015-04-13 23:01:57 +02:00
>bar : number, Symbol(bar, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 22, 17))
2014-08-15 23:33:16 +02:00
}
// ok, not enforcing assignability relation on this
constructor(x: any) {
2015-04-13 23:01:57 +02:00
>x : any, Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 27, 16))
2014-08-15 23:33:16 +02:00
super(x);
>super(x) : void
2015-04-13 23:01:57 +02:00
>super : typeof Base, Symbol(Base, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 0, 0))
>x : any, Symbol(x, Decl(constructorFunctionTypeIsAssignableToBaseType2.ts, 27, 16))
2014-08-15 23:33:16 +02:00
return 1;
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
}
}