TS2339: 属性 'batch' 在类型 'BatchDashboardComponent' 上不存在

TS2339: Property 'batch' does not exist on type 'BatchDashboardComponent'

所以我试图在这个哈巴狗文件table上显示一些模拟数据

  .container
    p-table([value]="batches")
      ng-template(pTemplate="header")
        tr
          th Batch ID
          th Batch Start
          th Batch End
          th Mismatched Customers
          th Customers Evaluated
      ng-template(pTemplate="body" let-batch='')
        tr
          td {{batch.batchId}}
          td {{batch.batchStart}}
          td {{batch.batchEnd}}
          td {{batch.quantityMismatched}}
          td {{batch.quantityEvaluated}}

但我不断收到错误提示 属性 'batch' 在类型 'BatchDashboardComponent'

上不存在

这是我的打字稿文件

import { Component, OnInit } from '@angular/core';
import { BatchData } from '../../util/data';
import { BATCHES } from '../../util/mock-data';
import { BatchService } from '../../services/batch/batch.service';

@Component({
  selector: 'batch-dashboard',
  templateUrl: './batch-dashboard.component.pug',
  styleUrls: ['./batch-dashboard.component.scss'],
  providers: [BatchService]
})
export class BatchDashboardComponent implements OnInit {
  batches: BatchData[];

  constructor(){

  }

  ngOnInit(){
    this.batches = BATCHES;
    console.log(this.batches);
  }
}

其中 BATCHES 是 BatchData 类型的模拟数据,如下所示

export interface BatchData {
  batchId: number,
  batchStart: string,
  batchEnd: string,
  quantityMismatched: number,
  quantityEvaluated: number
}

如果我知道为什么会出现此错误,我们将不胜感激?

编辑: 我也试过这些都无济于事

.centered-col-8
  .container
    p-table([value]="batches")
      ng-template(pTemplate="header")
        tr
          th Batch ID
          th Batch Start
          th Batch End
          th Mismatched Customers
          th Customers Evaluated
      ng-template(pTemplate="body" let-batch)
        tr
          td {{batch.batchId}}
          td {{batch.batchStart}}
          td {{batch.batchEnd}}
          td {{batch.quantityMismatched}}
          td {{batch.quantityEvaluated}}
.centered-col-8
  .container
    p-table([value]="batches")
      ng-template(pTemplate="header")
        tr
          th Batch ID
          th Batch Start
          th Batch End
          th Mismatched Customers
          th Customers Evaluated
      ng-template(pTemplate="body" let-batch [ngForOf]="batches")
        tr
          td {{batch.batchId}}
          td {{batch.batchStart}}
          td {{batch.batchEnd}}
          td {{batch.quantityMismatched}}
          td {{batch.quantityEvaluated}}

我想我解决了这个问题,我将其添加到打字稿文件中,错误消失了

batch: BatchData;