'typeof Store' 类型的参数不可分配给 'Store<AppState>' 类型的参数

Argument of type 'typeof Store' is not assignable to parameter of type 'Store<AppState>'

我正在尝试扩展使用 ngrx 的 angular 服务,但我遇到了这种类型的错误

Argument of type 'typeof Store' is not assignable to parameter of type 'Store<AppState>'

这是我的 parent class:

import { Store } from '@ngrx/store';
import { AppState } from '../store/file-uploader.state';
import { AbstractStorage } from '@storage';

export class FileUploaderService {
    constructor(
        private store: Store<AppState>,
        private storage: AbstractStorage,
    ) { }
}

还有我的childclass:

import { Store } from '@ngrx/store';
import { AppState } from '../store/file-uploader.state';
import { AbstractStorage } from '@storage';

export class DataSourceService extends FileUploaderService implements AbstractFileUploader  {
    constructor() {
        super(Store, AbstractStorage)
    }
}

我必须将这两个参数传递给 super。我试过传递 Store<AppState>,但它说它使用 Appstate 作为值,而不是类型。所以我不知道如何输入这个参数。有谁知道如何正确声明这个超级?

您应该将实例传递给 super 而不是键入。您可以尝试下面的代码,看看是否有帮助:

    export class DataSourceService extends FileUploaderService implements AbstractFileUploader  {
      constructor(private store: Store<AppState>, private storage: AbstractStorage) {
          super(store, storage);
      }
    }