0
我是新来的TypeScript。获取对象属性
如何解决这个问题:
layout[self._swapEntries ? '_rows' : 'rows'].slice(0, layout.numRowsToDraw);
错误:
error TS7017: Index signature of object type implicitly has an 'any' type.
另一个问题:
let entries = rows.selectAll("g." + Legend.LEGEND_ENTRY_CLASS).data((d) => d);
错误2:
error TS2345: Argument of type '(d: {}) => {}' is not assignable to parameter of type '(datum: {}, index: number, outerIndex: number) => {}[]'.
Type '{}' is not assignable to type '{}[]'.
Property 'length' is missing in type '{}'.
你知道这里有什么问题: 错误TS2345:类型的参数“( d:{})=> {}'不能分配给类型为'(datum:{},index:number,outerIndex:number)=> {} []'的参数。 类型“{}”不可分配为键入“{} []”。 类型“{}”中缺少属性“长度”。 – puppeteer701