From c453bab235ce8060288943b817f929001421a15e Mon Sep 17 00:00:00 2001 From: Pascal Corpet Date: Sat, 11 May 2024 07:21:19 +0200 Subject: [PATCH] fix(core): use readonly arrays for props as the libraries do not modify them --- packages/core/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 6df3710cb..60fd87439 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -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 = (datum: T) => string -export type Colors = string[] | string +export type Colors = readonly string[] | string export interface ColorProps { colors?: Colors colorBy?: string | GetColor @@ -278,11 +278,11 @@ export function useMotionConfig(): { export type SvgFillMatcher = (datum: T) => boolean export interface SvgDefsAndFill { - defs?: { + defs?: readonly { id: string [key: string]: any }[] - fill?: { id: string; match: Record | SvgFillMatcher | '*' }[] + fill?: readonly { id: string; match: Record | SvgFillMatcher | '*' }[] } export type CssMixBlendMode = @@ -394,7 +394,7 @@ export function PatternLines(props: Omit): JSX.Element export type Def = LinearGradientDef | PatternDotsDef | PatternSquaresDef | PatternLinesDef export type DefsProps = { - defs: Def[] + defs: readonly Def[] } export function Defs(props: DefsProps): JSX.Element @@ -547,7 +547,7 @@ interface CartesianMarkersProps< height: number xScale: (value: X) => number yScale: (value: Y) => number - markers: CartesianMarkerProps[] + markers: readonly CartesianMarkerProps[] } type CartesianMarkersType = ( props: CartesianMarkersProps @@ -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