Skip to content

Commit

Permalink
fix(pie): use readonly arrays for props as the library does not modif…
Browse files Browse the repository at this point in the history
…y them
  • Loading branch information
pcorpet committed Nov 14, 2023
1 parent 5306106 commit 0b78e5d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/pie/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface ComputedDatum<RawDatum> {
}

export interface DataProps<RawDatum> {
data: RawDatum[]
data: readonly RawDatum[]
}

export interface PieTooltipProps<RawDatum> {
Expand All @@ -73,7 +73,7 @@ export type MouseEventHandler<RawDatum, ElementType = HTMLCanvasElement> = (
export type PieLayerId = 'arcLinkLabels' | 'arcs' | 'arcLabels' | 'legends'

export interface PieCustomLayerProps<RawDatum> {
dataWithArc: ComputedDatum<RawDatum>[]
dataWithArc: readonly ComputedDatum<RawDatum>[]
centerX: number
centerY: number
radius: number
Expand Down Expand Up @@ -114,7 +114,7 @@ export type CommonPieProps<RawDatum> = {
isInteractive: boolean
tooltip: React.FC<PieTooltipProps<RawDatum>>

legends: LegendProps[]
legends: readonly LegendProps[]

role: string
renderWrapper: boolean
Expand All @@ -137,7 +137,7 @@ export type PieSvgProps<RawDatum> = DataProps<RawDatum> &
Partial<CommonPieProps<RawDatum>> &
SvgDefsAndFill<ComputedDatum<RawDatum>> &
PieHandlers<RawDatum, SVGPathElement> & {
layers?: PieLayer<RawDatum>[]
layers?: readonly PieLayer<RawDatum>[]
animate?: boolean
motionConfig?: MotionProps['motionConfig']
transitionMode?: ArcTransitionMode
Expand All @@ -148,7 +148,7 @@ export type CompletePieSvgProps<RawDatum> = DataProps<RawDatum> &
CommonPieProps<RawDatum> &
SvgDefsAndFill<ComputedDatum<RawDatum>> &
PieHandlers<RawDatum, SVGPathElement> & {
layers: PieLayer<RawDatum>[]
layers: readonly PieLayer<RawDatum>[]
animate: boolean
motionConfig: MotionProps['motionConfig']
transitionMode: ArcTransitionMode
Expand Down

0 comments on commit 0b78e5d

Please sign in to comment.