不存在OrderDetail,为啥还能用呢?
来源:2-15 【TS类晋级】深入TypeScript引用属性和它的4个真实应用场景-3

匆匆又夏天丶
2021-08-03
class Order {
public orderId: number = 0;
public date: Date = new Date();
public custname: string = 'aaaa';
public phone: string = '12312300001';
public orderDetail: OrderDetail[] = [];
constructor(orderId_: number, date_: Date, custname_: string, phone_: string) {
this.orderId = orderId_;
this.date = date_;
this.custname = custname_;
this.phone = phone_;
}
}
老是请问一下,这个文件中没有关系OrderDetail这个类型,为啥这个ts文件不报错呢?
写回答
1回答
-
keviny79
2021-08-04
上方有导入
022021-12-05
相似问题