diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 8f079742d..f8c8c8d39 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -1,5 +1,5 @@ import * as React from 'react' -import { OpaqueInterpolation, SpringConfig } from 'react-spring' +import { Interpolation, SpringConfig } from 'react-spring' declare module '@nivo/core' { export type DatumValue = string | number | Date @@ -208,7 +208,7 @@ declare module '@nivo/core' { | 'stepAfter' | 'stepBefore' - export function useAnimatedPath(path: string): OpaqueInterpolation + export function useAnimatedPath(path: string): Interpolation export type LinearGradientDef = { id: string @@ -250,23 +250,25 @@ declare module '@nivo/core' { defs: Def[] } - export declare const defaultAnimate = true - export declare const defaultMotionStiffness = 90 - export declare const defaultMotionDamping = 15 + export const defaultAnimate = true + export const defaultMotionStiffness = 90 + export const defaultMotionDamping = 15 - export declare const motionDefaultProps = { - animate: true, - stiffness: 90, - damping: 15, - config: 'default', + type MotionDefaultProps = { + animate: true + stiffness: 90 + damping: 15 + config: 'default' } + export const motionDefaultProps: MotionDefaultProps - export declare const defaultMargin = { - top: 0, - right: 0, - bottom: 0, - left: 0, + type DefaultMargin = { + top: 0 + right: 0 + bottom: 0 + left: 0 } + export const defaultMargin: DefaultMargin export function PatternLines(props: Omit): JSX.Element export function PatternSquares(props: Omit): JSX.Element @@ -277,7 +279,7 @@ declare module '@nivo/core' { export function degreesToRadians(degrees: number): number export function radiansToDegrees(radians: number): number - type Accessor = T extends string ? U[T] : never + type Accessor = T extends keyof U ? U[T] : never export type DatumPropertyAccessor = (datum: RawDatum) => T @@ -293,7 +295,7 @@ declare module '@nivo/core' { outerHeight: number } - export const SvgWrapper = ( + type SvgWrapperType = ( props: React.PropsWithChildren<{ width: number height: number @@ -302,6 +304,7 @@ declare module '@nivo/core' { role?: string }> ) => JSX.Element + export const SvgWrapper: SvgWrapperType interface ContainerProps { theme?: Theme @@ -313,18 +316,17 @@ declare module '@nivo/core' { motionConfig?: string | SpringConfig } - export const Container = (props: React.PropsWithChildren) => JSX.Element + type ContainerType = (props: React.PropsWithChildren) => JSX.Element + export const Container: ContainerType - export const ResponsiveWrapper = (props: { + type ResponsiveWrapperType = (props: { children: (dimensions: { width: number; height: number }) => JSX.Element }) => JSX.Element + export const ResponsiveWrapper: ResponsiveWrapperType export function getDistance(x1: number, y1: number, x2: number, y2: number): number export function getAngle(x1: number, y1: number, x2: number, y2: number): number - export function radiansToDegrees(radians: number): number - export function degreesToRadians(degrees: number): number - export function positionFromAngle( angle: number, distance: number