diff --git a/src/components/common/ListExplorer.vue b/src/components/common/ListExplorer.vue index 6bdb007cdf..0cf554c936 100644 --- a/src/components/common/ListExplorer.vue +++ b/src/components/common/ListExplorer.vue @@ -42,7 +42,7 @@ > - {{ row._display[item.key] }} + {{ (row._display as any)[item.key] }} @@ -73,9 +73,7 @@ type Item = { size: number } -type RecordString = { - [key in keyof T]: T[key] -} +type RecordString = Record type ResolvedItem = T & { icon: string @@ -137,23 +135,29 @@ const sortField = ref('name') const iconMapLegacy = (icon: string) => { const prefix = 'pi-' - const legacy = { + const legacy: Record = { audio: 'headphones' } return prefix + (legacy[icon] || icon) } const renderedItems = computed(() => { - const columnRenderText = columns.value.reduce((acc, column) => { - acc[column.key] = column.renderText - return acc - }, {}) + const columnRenderText = columns.value.reduce( + (acc, column) => { + acc[column.key] = column.renderText + return acc + }, + {} as Record string> + ) return props.items.map((item) => { - const display = Object.entries(item).reduce((acc, [key, value]) => { - acc[key] = columnRenderText[key]?.(value, item) ?? value - return acc - }, {} as RecordString) + const display = Object.entries(item).reduce( + (acc, [key, value]) => { + acc[key] = columnRenderText[key]?.(value, item) ?? value + return acc + }, + {} as Record + ) return { ...item, icon: iconMapLegacy(item.type), _display: display } }) }) @@ -173,8 +177,8 @@ const sortedItems = computed(() => { const direction = sortDirection.value === 'asc' ? 1 : -1 const sorting = (a: ResolvedItem, b: ResolvedItem) => { - const aValue = a[sortField.value] - const bValue = b[sortField.value] + const aValue = (a as any)[sortField.value] + const bValue = (b as any)[sortField.value] const result = typeof aValue === 'string' diff --git a/src/components/common/VirtualScroll.vue b/src/components/common/VirtualScroll.vue index 358058d60f..2cb566ff07 100644 --- a/src/components/common/VirtualScroll.vue +++ b/src/components/common/VirtualScroll.vue @@ -19,7 +19,7 @@