bug fix: type error in chart.tsx (#4230)

# Current Issue
when running `next lint`, the typescript compiler fails on the chart component (closes #4229 )
`Type error: Type 'string[]' is not assignable to type 'string | TrustedHTML'.`

# Resolution

We can coerce the `string[]` into a valid type by `join`ing.
This commit is contained in:
Ariel
2024-07-11 16:14:44 +03:00
committed by GitHub
parent 03b1d783c4
commit f170784f78
4 changed files with 12 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -79,8 +79,9 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
return (
<style
dangerouslySetInnerHTML={{
__html: Object.entries(THEMES).map(
([theme, prefix]) => `
__html: Object.entries(THEMES)
.map(
([theme, prefix]) => `
${prefix} [data-chart=${id}] {
${colorConfig
.map(([key, itemConfig]) => {
@@ -92,7 +93,8 @@ ${colorConfig
.join("\n")}
}
`
),
)
.join("\n"),
}}
/>
)

View File

@@ -79,8 +79,9 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
return (
<style
dangerouslySetInnerHTML={{
__html: Object.entries(THEMES).map(
([theme, prefix]) => `
__html: Object.entries(THEMES)
.map(
([theme, prefix]) => `
${prefix} [data-chart=${id}] {
${colorConfig
.map(([key, itemConfig]) => {
@@ -92,7 +93,8 @@ ${colorConfig
.join("\n")}
}
`
),
)
.join("\n"),
}}
/>
)