Skip to content

Commit

Permalink
fix(core): use readonly arrays for props as the libraries do not modi…
Browse files Browse the repository at this point in the history
…fy them
  • Loading branch information
pcorpet authored and plouc committed May 12, 2024
1 parent a36b73d commit b683244
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export type BoxAlign =
| 'bottom'
| 'bottom-left'
| 'left'
export const boxAlignments: BoxAlign[]
export const boxAlignments: readonly BoxAlign[]
export function alignBox(box: AlignBox, container: AlignBox, alignment: BoxAlign): [number, number]

export type GetColor<T> = (datum: T) => string
export type Colors = string[] | string
export type Colors = readonly string[] | string
export interface ColorProps<T> {
colors?: Colors
colorBy?: string | GetColor<T>
Expand Down Expand Up @@ -278,11 +278,11 @@ export function useMotionConfig(): {

export type SvgFillMatcher<T> = (datum: T) => boolean
export interface SvgDefsAndFill<T> {
defs?: {
defs?: readonly {
id: string
[key: string]: any
}[]
fill?: { id: string; match: Record<string, unknown> | SvgFillMatcher<T> | '*' }[]
fill?: readonly { id: string; match: Record<string, unknown> | SvgFillMatcher<T> | '*' }[]
}

export type CssMixBlendMode =
Expand Down Expand Up @@ -394,7 +394,7 @@ export function PatternLines(props: Omit<PatternLinesDef, 'type'>): JSX.Element
export type Def = LinearGradientDef | PatternDotsDef | PatternSquaresDef | PatternLinesDef

export type DefsProps = {
defs: Def[]
defs: readonly Def[]
}

export function Defs(props: DefsProps): JSX.Element
Expand Down Expand Up @@ -547,7 +547,7 @@ interface CartesianMarkersProps<
height: number
xScale: (value: X) => number
yScale: (value: Y) => number
markers: CartesianMarkerProps<X | Y>[]
markers: readonly CartesianMarkerProps<X | Y>[]
}
type CartesianMarkersType = <X extends DatumValue = DatumValue, Y extends DatumValue = DatumValue>(
props: CartesianMarkersProps<X, Y>
Expand Down Expand Up @@ -605,7 +605,7 @@ export type ClosedCurveFactoryId =
| 'cardinalClosed'
| 'catmullRomClosed'
| 'linearClosed'
export const closedCurvePropKeys: ClosedCurveFactoryId[]
export const closedCurvePropKeys: readonly ClosedCurveFactoryId[]

export const curveFromProp: (interpolation: CurveFactoryId) => CurveFactory

Expand Down

0 comments on commit b683244

Please sign in to comment.