'{ src: string; 类型的参数拇指:字符串; }' 不可分配给 'never' 类型的参数

Argument of type '{ src: string; thumb: string; }' is not assignable to parameter of type 'never'

打字稿代码:

我的代码不工作,我不明白这个错误 '{ src: string; 类型的参数拇指:字符串; }' 不可分配给 'never'

类型的参数
  _albums = [];

  constructor(
    private wowService: NgwWowService,
    private _lightbox: Lightbox
    ) {
    this.wowService.init();

    for (let i = 1; i <= 4; i++) {
      const src = 'assets/desktop/galeria/' + i + '.jpg';
      const thumb = 'assets/desktop/galeria/' + i + '.jpg';
      const album = {
         src: src,
         thumb: thumb
      };
      this._albums.push(album);
    }
  }

  open(index: number): void {
    // open lightbox
    this._lightbox.open(this._albums, index);
  }

  close(): void {
    // close lightbox programmatically
    this._lightbox.close();
  }

您需要输入 _albums。您已经定义了 _albums = [],打字稿将其推断为 never[],因此,如果您尝试推入数组,则将 { src: string; thumb: string; } 分配给 never

下面会起作用

_albums:{ src: string; thumb: string; }[] = [];