mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 17:08:47 +02:00
Fix all 20 pre-existing type errors; typecheck now green
- ui/chart.tsx: recharts 3 stopped exposing tooltip/legend content props on its public types; declare the ChartPayloadItem shape we consume - base-ui Select onValueChange passes string|null: guard null in BillingCycleSelector, PasteImportModal, TransactionModal - type the untyped api.get calls (cycles, categories) - push-notifications: back the VAPID key with an explicit ArrayBuffer so it satisfies BufferSource under TS 5.9 Unblocks gating CI on pnpm typecheck. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,17 @@ ${colorConfig
|
||||
|
||||
const ChartTooltip = RechartsPrimitive.Tooltip
|
||||
|
||||
// recharts 3 no longer exposes the tooltip/legend content props on its public
|
||||
// component types; declare the shape we actually consume.
|
||||
type ChartPayloadItem = {
|
||||
dataKey?: string | number
|
||||
name?: string | number
|
||||
value?: number | string
|
||||
color?: string
|
||||
type?: string
|
||||
payload?: Record<string, unknown> & { fill?: string }
|
||||
}
|
||||
|
||||
function ChartTooltipContent({
|
||||
active,
|
||||
payload,
|
||||
@@ -118,8 +129,23 @@ function ChartTooltipContent({
|
||||
color,
|
||||
nameKey,
|
||||
labelKey,
|
||||
}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
||||
React.ComponentProps<"div"> & {
|
||||
}: React.ComponentProps<"div"> & {
|
||||
active?: boolean
|
||||
payload?: ChartPayloadItem[]
|
||||
label?: string | number
|
||||
labelFormatter?: (
|
||||
value: string | number,
|
||||
payload: ChartPayloadItem[]
|
||||
) => React.ReactNode
|
||||
labelClassName?: string
|
||||
formatter?: (
|
||||
value: number | string,
|
||||
name: string | number,
|
||||
item: ChartPayloadItem,
|
||||
index: number,
|
||||
payload: unknown
|
||||
) => React.ReactNode
|
||||
color?: string
|
||||
hideLabel?: boolean
|
||||
hideIndicator?: boolean
|
||||
indicator?: "line" | "dot" | "dashed"
|
||||
@@ -144,7 +170,7 @@ function ChartTooltipContent({
|
||||
if (labelFormatter) {
|
||||
return (
|
||||
<div className={cn("font-medium", labelClassName)}>
|
||||
{labelFormatter(value, payload)}
|
||||
{labelFormatter(value as string | number, payload)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -184,7 +210,7 @@ function ChartTooltipContent({
|
||||
.map((item, index) => {
|
||||
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
||||
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
||||
const indicatorColor = color || item.payload.fill || item.color
|
||||
const indicatorColor = color || item.payload?.fill || item.color
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -258,8 +284,9 @@ function ChartLegendContent({
|
||||
payload,
|
||||
verticalAlign = "bottom",
|
||||
nameKey,
|
||||
}: React.ComponentProps<"div"> &
|
||||
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
||||
}: React.ComponentProps<"div"> & {
|
||||
payload?: ChartPayloadItem[]
|
||||
verticalAlign?: "top" | "middle" | "bottom"
|
||||
hideIcon?: boolean
|
||||
nameKey?: string
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user