Skip to content

Commit

Permalink
fix type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marthasharkey committed Nov 22, 2024
1 parent 529914f commit ee75297
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class TableVisualisationTooltip implements ITooltipComp {
*/
init(
params: ITooltipParams & {
dataQualityMetrics: Map<string, number>[]
dataQualityMetrics: Record<string, number>[]
total: number
showDataQuality: boolean
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interface UnknownTable {
get_child_node_action: string
get_child_node_link_name: string
link_value_type: string
data_quality_pairs?: Map<string, number[]>[]
data_quality_pairs?: Record<string, number[]>[]
}
export type TextFormatOptions = 'full' | 'partial' | 'off'
Expand Down Expand Up @@ -353,15 +353,15 @@ function toField(
const dataQualityMetrics =
typeof props.data === 'object' && 'data_quality_pairs' in props.data ?
props.data.data_quality_pairs.map(obj => {
props.data.data_quality_pairs.map((obj: Record<string, number[]>) => {
const key = Object.keys(obj)[0] as string
return {[key]: obj[key][index]}
return { [key]: obj[key]?.[index!] ?? 0 };
})
// eslint-disable-next-line camelcase
: [{ number_of_nothing: 0 }, {number_of_whitespace: 0 }]
: [{ number_of_nothing: 0 }, { number_of_whitespace: 0 }]
const showDataQuality = dataQualityMetrics.filter(obj => Object.values(obj)[0] as number > 0).length > 0;
const showDataQuality =
dataQualityMetrics.filter((obj) => (Object.values(obj)[0] as number) > 0).length > 0
const getSvgTemplate = (icon: string) =>
`<svg viewBox="0 0 16 16" width="16" height="16"> <use xlink:href="${icons}#${icon}"/> </svg>`
Expand Down

0 comments on commit ee75297

Please sign in to comment.