mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
27 lines
943 B
Plaintext
27 lines
943 B
Plaintext
classAbstractFactoryFunction.ts(9,12): error TS2511: Cannot create an instance of an abstract class.
|
|
classAbstractFactoryFunction.ts(13,6): error TS2345: Argument of type 'typeof B' is not assignable to parameter of type 'typeof A'.
|
|
Cannot assign an abstract constructor type to a non-abstract constructor type.
|
|
|
|
|
|
==== classAbstractFactoryFunction.ts (2 errors) ====
|
|
class A {}
|
|
abstract class B extends A {}
|
|
|
|
function NewA(Factory: typeof A) {
|
|
return new A;
|
|
}
|
|
|
|
function NewB(Factory: typeof B) {
|
|
return new B;
|
|
~~~~~
|
|
!!! error TS2511: Cannot create an instance of an abstract class.
|
|
}
|
|
|
|
NewA(A);
|
|
NewA(B);
|
|
~
|
|
!!! error TS2345: Argument of type 'typeof B' is not assignable to parameter of type 'typeof A'.
|
|
!!! error TS2345: Cannot assign an abstract constructor type to a non-abstract constructor type.
|
|
|
|
NewB(A);
|
|
NewB(B); |