I do not undestand of TS error
Here is an example of code
interface initParams {
withoutAuth?: any;
scripts?: any; // ссылка на файл, который выдает скрипты
setProxy: any;
}
class LoaderService {
bar1: any;
constructor() {
}
}
class ServerBaseService<T extends LoaderService> {
constructor(
private readonly _createClass: { new(): T },
private readonly isKube: boolean,
) {
}
}
class HttpLoaderService extends LoaderService {
constructor({ withoutAuth, scripts, setProxy }: initParams) {
super()
}
}
class ServerHTTPService<T extends HttpLoaderService> extends ServerBaseService<T> {
constructor(
private readonly _createClasss: new () => T, //{ new(): T }
private readonly withoutAuth: boolean,
private readonly setProxy: boolean,
private readonly isKubee: boolean
) {
super(_createClasss, isKubee) //_createClasss, // будет вызван конструктор ServerBaseService
}
}
class AuthLoaderService extends HttpLoaderService {
}
class AuthenticationServerService extends ServerHTTPService<AuthLoaderService> {
constructor({ withoutAuth, setProxy, isKube }: { withoutAuth: boolean, setProxy: boolean, isKube: boolean }) {
super(AuthLoaderService,withoutAuth,setProxy,isKube)
}
}
Why here is an error
Argument of type 'typeof AuthLoaderService' is not assignable to parameter of type 'new () => AuthLoaderService'.
Types of construct signatures are incompatible.
Type 'new ({ withoutAuth, scripts, setProxy }: initParams) => AuthLoaderService' is not assignable to type 'new () => AuthLoaderService'
In AuthenticationServerService when calling super it refer on ServerHTTPService constructor.
But error message is refer on HttpLoaderService constructor signature.
Why???
Can anybody explain this error?