Skip to content

Commit 0c83045

Browse files
fix: resolve type errors?
1 parent 44633cb commit 0c83045

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

src/components/ui/chart.tsx

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,26 @@ function ChartTooltipContent({
116116
color,
117117
nameKey,
118118
labelKey,
119-
}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
120-
React.ComponentProps<"div"> & {
119+
}: {
120+
active?: boolean;
121+
payload?: any[];
122+
label?: any;
123+
} & React.ComponentProps<"div"> & {
121124
hideLabel?: boolean;
122125
hideIndicator?: boolean;
123126
indicator?: "line" | "dot" | "dashed";
124127
nameKey?: string;
125128
labelKey?: string;
129+
labelFormatter?: (value: any, payload: any[]) => React.ReactNode;
130+
formatter?: (
131+
value: any,
132+
name: any,
133+
item: any,
134+
index: number,
135+
payload: any,
136+
) => React.ReactNode;
137+
color?: string;
138+
labelClassName?: string;
126139
}) {
127140
const { config } = useChart();
128141

@@ -177,7 +190,7 @@ function ChartTooltipContent({
177190
>
178191
{!nestLabel ? tooltipLabel : null}
179192
<div className="grid gap-1.5">
180-
{payload.map((item, index) => {
193+
{payload.map((item: any, index: number) => {
181194
const key = `${nameKey || item.name || item.dataKey || "value"}`;
182195
const itemConfig = getPayloadConfigFromPayload(config, item, key);
183196
const indicatorColor = color || item.payload.fill || item.color;
@@ -254,11 +267,12 @@ function ChartLegendContent({
254267
payload,
255268
verticalAlign = "bottom",
256269
nameKey,
257-
}: React.ComponentProps<"div"> &
258-
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
259-
hideIcon?: boolean;
260-
nameKey?: string;
261-
}) {
270+
}: React.ComponentProps<"div"> & {
271+
payload?: any[];
272+
verticalAlign?: "top" | "bottom";
273+
hideIcon?: boolean;
274+
nameKey?: string;
275+
}) {
262276
const { config } = useChart();
263277

264278
if (!payload?.length) {
@@ -273,7 +287,7 @@ function ChartLegendContent({
273287
className,
274288
)}
275289
>
276-
{payload.map((item) => {
290+
{payload.map((item: any) => {
277291
const key = `${nameKey || item.dataKey || "value"}`;
278292
const itemConfig = getPayloadConfigFromPayload(config, item, key);
279293

src/main.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ import "./i18n";
66

77
import App from "./App";
88

9+
// Type declaration for Monaco Environment
10+
declare global {
11+
interface Window {
12+
MonacoEnvironment: {
13+
getWorker: (workerId: any, label: string) => Worker;
14+
};
15+
}
16+
}
17+
918
// Import Monaco Editor workers using Vite's worker syntax
1019
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
1120
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";

0 commit comments

Comments
 (0)