Files
tsgo/testdata/baselines/reference/compiler/noCrashOnMixin2.errors.txt

41 lines
1.5 KiB
Plaintext

noCrashOnMixin2.ts(11,33): error TS2370: A rest parameter must be of an array type.
noCrashOnMixin2.ts(11,40): error TS1047: A rest parameter cannot be optional.
noCrashOnMixin2.ts(14,12): error TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'.
noCrashOnMixin2.ts(23,9): error TS2674: Constructor of class 'Abstract' is protected and only accessible within the class declaration.
==== noCrashOnMixin2.ts (4 errors) ====
// https://github.com/microsoft/TypeScript/issues/62921
class Abstract {
protected constructor() {
}
}
class Concrete extends Abstract {
}
type Constructor<T = {}> = new (...args?: any[]) => T;
~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
~
!!! error TS1047: A rest parameter cannot be optional.
function Mixin<TBase extends Constructor>(Base: TBase) {
return class extends Base {
~~~~~
!!! error TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'.
};
}
class Empty {
}
class CrashTrigger extends Mixin(Empty) {
public trigger() {
new Concrete();
~~~~~~~~~~~~~~
!!! error TS2674: Constructor of class 'Abstract' is protected and only accessible within the class declaration.
}
}