ts如何定义数组中嵌套对象的类型

定义类型:

interface ObjectOf<V> { 
  [_: string]: V
}
class OrderItem { 
  uuid: string;
  amount: number;
  secondaryTotal: number;
  total: number;
  originalTotal: number;
  checked: boolean;
}

使用

interface State { 
	 promoList: { 
	    giftCheck:ObjectOf<OrderItem>
	    freeCheck:Array<OrderItem>
	  }
  }
    原文作者:凉生可可
    原文地址: https://blog.csdn.net/weixin_43466871/article/details/106094568
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞