1
キーで配列内の要素を取得する必要があります。角2 TypeScript配列の要素を取得する方法
const legendColors = {'On Hold': '#ef2e2e', 'Shipped': '#ff8e28', 'Complete': '#61c673', 'New': '#007cbb'};
...
return {name: v.name, value: v.value, color: legendColors[v.name]};
リントツールlegendColors[v.name]
にこのエラーを返す:
ERROR in src/app/pages/orders/orders.composant.ts(46,62): error TS7017: Element implicitly has an 'any' type because type '{ 'On Hold': string; 'Shipped': string; 'Complete': string; 'New': string; }' has no index signature.