Skip to content

Commit

Permalink
fix(line): use readonly arrays for props as the library does not modi…
Browse files Browse the repository at this point in the history
…fy them (#2494)
  • Loading branch information
pcorpet committed Mar 5, 2024
1 parent 0ab8f73 commit 193a4ce
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/line/index.d.ts
Expand Up @@ -43,12 +43,12 @@ export interface ComputedDatum {

export interface Serie {
id: string | number
data: Datum[]
data: readonly Datum[]
[key: string]: any
}
export interface ComputedSerie {
id: string | number
data: ComputedDatum[]
data: readonly ComputedDatum[]
color?: string
[key: string]: any
}
Expand All @@ -69,8 +69,8 @@ export interface CustomLayerProps extends Omit<LineSvgProps, 'xScale' | 'yScale'
innerHeight: number
innerWidth: number
lineGenerator: D3Line<ComputedDatum['position']>
points: Point[]
series: ComputedSerie[]
points: readonly Point[]
series: readonly ComputedSerie[]
xScale: Scale<unknown, unknown>
yScale: Scale<unknown, unknown>
}
Expand Down Expand Up @@ -116,7 +116,7 @@ export interface SliceTooltipProps {
x: number
y0: number
y: number
points: Point[]
points: readonly Point[]
}
}
export type SliceTooltip = React.FunctionComponent<SliceTooltipProps>
Expand All @@ -130,14 +130,14 @@ export interface PointSymbolProps {
}

export interface LineProps {
data: Serie[]
data: readonly Serie[]

xScale?: ScaleSpec
xFormat?: ValueFormat<DatumValue>
yScale?: ScaleSpec
yFormat?: ValueFormat<DatumValue>

layers?: Layer[]
layers?: readonly Layer[]

margin?: Box

Expand Down Expand Up @@ -179,7 +179,7 @@ export interface LineProps {
areaOpacity?: number
areaBaselineValue?: DatumValue

markers?: CartesianMarkerProps[]
markers?: readonly CartesianMarkerProps[]

isInteractive?: boolean
onMouseEnter?: PointMouseHandler
Expand All @@ -203,7 +203,7 @@ export interface LineProps {
crosshairType?: CrosshairType
enableTouchCrosshair?: boolean

legends?: LegendProps[]
legends?: readonly LegendProps[]
}

export interface LineSvgProps extends LineProps, MotionProps, SvgDefsAndFill<Datum> {
Expand All @@ -227,7 +227,7 @@ export type CanvasLayer = LineLayerType | CustomCanvasLayer

export interface LineCanvasProps extends Omit<LineProps, 'layers'> {
pixelRatio?: number
layers?: CanvasLayer[]
layers?: readonly CanvasLayer[]
}

export class LineCanvas extends React.Component<LineCanvasProps & Dimensions> {}
Expand Down

0 comments on commit 193a4ce

Please sign in to comment.