如何填充正在填充的类型具有函数的类型数组(getReadableSchedule)?如果我删除该功能,这是有效的.这是因为我分配数组元素的方式失败了吗?
src/app/mock-extracts.ts(3,14)中的错误:错误TS2322:类型'{id:number;中缺少属性'getReadableSchedule' name:string; 描述:字符串; 客户端:字符串; 供应商:字符串; extractType:str ...'.
export class Extract {
id: number;
name: string;
description: string;
client: string;
vendor: string;
extractType: string;
path: string;
sentDate: string;
sentTo: string;
lastRun: string;
nextRun: string;
schedule: string;
getReadableSchedule(): string {
return "<return readable cronjob schedule>";
}
}
Run Code Online (Sandbox Code Playgroud)
import { Extract } from "./extract";
export const EXTRACTS: Extract[] = [
{
id: 1,
name: "Find Barb",
description: "Find Barb in the unspide down.",
client: "Tower, Inc",
vendor: "Vendy",
extractType: "Normal",
sentDate: "Today", …Run Code Online (Sandbox Code Playgroud) typescript ×1