Skip to content

Commit

Permalink
fix(core): fix invalid core types (#1386)
Browse files Browse the repository at this point in the history
Co-authored-by: Neil Kistner <neil.kistner@gmail.com>
  • Loading branch information
Callum Mellor-Reed and wyze authored Apr 23, 2021
1 parent 1d94b5f commit 296f5d1
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -208,7 +208,7 @@ declare module '@nivo/core' {
| 'stepAfter'
| 'stepBefore'

export function useAnimatedPath(path: string): OpaqueInterpolation<string>
export function useAnimatedPath(path: string): Interpolation<string>

export type LinearGradientDef = {
id: string
Expand Down Expand Up @@ -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<PatternLinesDef, 'type'>): JSX.Element
export function PatternSquares(props: Omit<PatternSquaresDef, 'type'>): JSX.Element
Expand All @@ -277,7 +279,7 @@ declare module '@nivo/core' {
export function degreesToRadians(degrees: number): number
export function radiansToDegrees(radians: number): number

type Accessor<T, U> = T extends string ? U[T] : never
type Accessor<T, U> = T extends keyof U ? U[T] : never

export type DatumPropertyAccessor<RawDatum, T> = (datum: RawDatum) => T

Expand All @@ -293,7 +295,7 @@ declare module '@nivo/core' {
outerHeight: number
}

export const SvgWrapper = (
type SvgWrapperType = (
props: React.PropsWithChildren<{
width: number
height: number
Expand All @@ -302,6 +304,7 @@ declare module '@nivo/core' {
role?: string
}>
) => JSX.Element
export const SvgWrapper: SvgWrapperType

interface ContainerProps {
theme?: Theme
Expand All @@ -313,18 +316,17 @@ declare module '@nivo/core' {
motionConfig?: string | SpringConfig
}

export const Container = (props: React.PropsWithChildren<ContainerProps>) => JSX.Element
type ContainerType = (props: React.PropsWithChildren<ContainerProps>) => 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
Expand Down

0 comments on commit 296f5d1

Please sign in to comment.