You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR in src/components/FetchData/FetchData.tsx:99:19
TS2345: Argument of type 'DSVRowArray<string> | PieArcDatum<number>' is not assignable to parameter of type '(number | { valueOf(): number; })[]'.
Type 'DSVRowArray<string>' is not assignable to type '(number | { valueOf(): number; })[]'.
The types returned by 'pop()' are incompatible between these types.
Type 'DSVRowString<string> | undefined' is not assignable to type 'number | { valueOf(): number; } | undefined'.
Type 'DSVRowString<string>' is not assignable to type 'number | { valueOf(): number; } | undefined'.
Type 'DSVRowString<string>' is not assignable to type '{ valueOf(): number; }'.
The types returned by 'valueOf()' are incompatible between these types.
Type 'Object' is not assignable to type 'number'.
97 | } */}
98 |
> 99 | {colorPie(data).map((d: DSVRowArray<string> | PieArcDatum<number>) => (
| ^^^^
100 | <path
101 | key={Math.random()}
102 | fill={d.data["RGB hex value"]}
ERROR in src/components/FetchData/FetchData.tsx:99:29
TS2345: Argument of type '(d: DSVRowArray<string> | PieArcDatum<number>) => JSX.Element' is not assignable to parameter of type '(value: PieArcDatum<number | { valueOf(): number; }>, index: number, array: PieArcDatum<number | { valueOf(): number; }>[]) => Element'.
Types of parameters 'd' and 'value' are incompatible.
Type 'PieArcDatum<number | { valueOf(): number; }>' is not assignable to type 'DSVRowArray<string> | PieArcDatum<number>'.
Type 'PieArcDatum<number | { valueOf(): number; }>' is not assignable to type 'PieArcDatum<number>'.
Type 'number | { valueOf(): number; }' is not assignable to type 'number'.
Type '{ valueOf(): number; }' is not assignable to type 'number'.
97 | } */}
98 |
> 99 | {colorPie(data).map((d: DSVRowArray<string> | PieArcDatum<number>) => (
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 100 | <path
| ^^^^^^^^^^^^^^^
> 101 | key={Math.random()}
| ^^^^^^^^^^^^^^^
> 102 | fill={d.data["RGB hex value"]}
| ^^^^^^^^^^^^^^^
> 103 | d={pieArc(d)!}
| ^^^^^^^^^^^^^^^
> 104 | />
| ^^^^^^^^^^^^^^^
> 105 | ))}
| ^^^^^^^^^^
106 | </g>
107 | </svg>
108 | );
ERROR in src/components/FetchData/FetchData.tsx:102:21
TS2339: Property 'data' does not exist on type 'DSVRowArray<string> | PieArcDatum<number>'.
Property 'data' does not exist on type 'DSVRowArray<string>'.
100 | <path
101 | key={Math.random()}
> 102 | fill={d.data["RGB hex value"]}
| ^^^^
103 | d={pieArc(d)!}
104 | />
105 | ))}
ERROR in src/components/FetchData/FetchData.tsx:103:23
TS2769: No overload matches this call.
Overload 1 of 2, '(this: any, d: DefaultArcObject, ...args: any[]): string | null', gave the following error.
Argument of type 'DSVRowArray<string> | PieArcDatum<number>' is not assignable to parameter of type 'DefaultArcObject'.
Type 'DSVRowArray<string>' is missing the following properties from type 'DefaultArcObject': innerRadius, outerRadius, startAngle, endAngle
Overload 2 of 2, '(this: any, d: DefaultArcObject, ...args: any[]): void', gave the following error.
Argument of type 'DSVRowArray<string> | PieArcDatum<number>' is not assignable to parameter of type 'DefaultArcObject'.
Type 'DSVRowArray<string>' is not assignable to type 'DefaultArcObject'.
101 | key={Math.random()}
102 | fill={d.data["RGB hex value"]}
> 103 | d={pieArc(d)!}
| ^
104 | />
105 | ))}
106 | </g>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Now, how should I solve this/typecast this?
The code executes but with errors in VSCode.
In CodeSandBox it's working fine. No error. Playground: https://codesandbox.io/s/frosty-cannon-bfxprg?file=/src/FetchData.tsx:0-975
I'm also pasting the errors here:
Beta Was this translation helpful? Give feedback.
All reactions