UNPKG

recharts

Version:
24 lines (23 loc) • 1.48 kB
import { TickItem } from './types'; import { RechartsScale } from './scale/RechartsScale'; /** * So usually React would compare only the first level of props using Object.is. * However, in our case many props are objects or arrays, and our own docs recommend to do that! * Therefore, we need a custom comparison function that does a shallow comparison of each prop value. * * Because charts can and do receive large props (typically the data array), * we only limit this to a subset of known props that are likely to be objects/arrays. * * @param prevProps * @param nextProps */ export declare function propsAreEqual<T extends Record<string, unknown>>(prevProps: T, nextProps: T): boolean; export declare function areNumbersApproximatelyEqual(a: number | undefined, b: number | undefined): boolean; export declare function areChartValuesApproximatelyEqual(a: unknown, b: unknown): boolean; export declare function areValueArraysApproximatelyEqual(a: ReadonlyArray<unknown> | undefined, b: ReadonlyArray<unknown> | undefined): boolean; /** * Compares two scales by their observable domain, range and bandwidth outputs. The scale * implementation/type and other configuration are intentionally not compared. */ export declare function areScalesApproximatelyEqual(a: RechartsScale | undefined, b: RechartsScale | undefined): boolean; export declare function areRenderedTicksEqual(a: ReadonlyArray<TickItem> | null | undefined, b: ReadonlyArray<TickItem>): boolean;