From b33410951a42b1b84f6525e6af76874e411be4ce Mon Sep 17 00:00:00 2001 From: Madeline Harris Date: Mon, 27 Apr 2020 22:27:56 +0100 Subject: [PATCH 1/2] Add missing DefinitelyTyped props to VictorySlice and VictoryPie --- packages/victory-pie/src/index.d.ts | 43 +++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/packages/victory-pie/src/index.d.ts b/packages/victory-pie/src/index.d.ts index 056419940..8936e241f 100644 --- a/packages/victory-pie/src/index.d.ts +++ b/packages/victory-pie/src/index.d.ts @@ -1,26 +1,34 @@ import * as React from "react"; import { + CategoryPropType, ColorScalePropType, DataGetterPropType, EventPropTypeInterface, + NumberOrCallback, + OriginType, SliceNumberOrCallback, StringOrNumberOrCallback, VictoryCommonProps, + VictoryLabelableProps, VictoryMultiLabelableProps, VictoryStyleInterface } from "victory-core"; +export type labelPositionType = "startAngle" | "centroid" | "endAngle"; + +export type innerRadiusType = + | number + | (( + props: { + active?: boolean; + datum?: any; + } + ) => number); + export interface VictorySliceProps extends VictoryCommonProps { cornerRadius?: SliceNumberOrCallback; datum?: any; - innerRadius?: - | number - | (( - props: { - active?: boolean; - datum?: any; - } - ) => number); + innerRadius?: innerRadiusType; padAngle?: SliceNumberOrCallback; pathComponent?: React.ReactElement; pathFunction?: (props: VictorySliceProps) => string; @@ -35,22 +43,27 @@ export interface VictorySliceProps extends VictoryCommonProps { sliceStartAngle?: SliceNumberOrCallback; } -export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabelableProps { +export interface VictoryPieProps + extends VictoryCommonProps, + VictoryLabelableProps, + VictoryMultiLabelableProps { + categories?: CategoryPropType; colorScale?: ColorScalePropType; + cornerRadius?: number; data?: any[]; dataComponent?: React.ReactElement; - labelPosition?: "startAngle" | "centroid" | "endAngle" | ((props: VictorySliceProps) => string); - labelRadius?: number | ((props: VictorySliceProps) => number); endAngle?: number; events?: EventPropTypeInterface< "data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[] >[]; eventKey?: StringOrNumberOrCallback; - radius?: number | ((props: VictorySliceProps) => number); - innerRadius?: number | ((props: VictorySliceProps) => number); - cornerRadius?: number; - padAngle?: number; + innerRadius?: innerRadiusType; + labelPosition?: labelPositionType | ((props: VictorySliceProps) => labelPositionType); + labelRadius?: number | ((props: VictorySliceProps) => number); + origin?: OriginType; + padAngle?: NumberOrCallback; + radius?: NumberOrCallback; startAngle?: number; style?: VictoryStyleInterface; x?: DataGetterPropType; From 687efce325425077f480fb6431717ca758fbde91 Mon Sep 17 00:00:00 2001 From: Madeline Harris Date: Wed, 29 Apr 2020 21:55:11 +0100 Subject: [PATCH 2/2] Update cornerRadius and innerRadius for VictoryPie and VictorySlice --- packages/victory-pie/src/index.d.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/victory-pie/src/index.d.ts b/packages/victory-pie/src/index.d.ts index 8936e241f..5f14adbaa 100644 --- a/packages/victory-pie/src/index.d.ts +++ b/packages/victory-pie/src/index.d.ts @@ -16,19 +16,10 @@ import { export type labelPositionType = "startAngle" | "centroid" | "endAngle"; -export type innerRadiusType = - | number - | (( - props: { - active?: boolean; - datum?: any; - } - ) => number); - export interface VictorySliceProps extends VictoryCommonProps { cornerRadius?: SliceNumberOrCallback; datum?: any; - innerRadius?: innerRadiusType; + innerRadius?: NumberOrCallback; padAngle?: SliceNumberOrCallback; pathComponent?: React.ReactElement; pathFunction?: (props: VictorySliceProps) => string; @@ -49,7 +40,7 @@ export interface VictoryPieProps VictoryMultiLabelableProps { categories?: CategoryPropType; colorScale?: ColorScalePropType; - cornerRadius?: number; + cornerRadius?: SliceNumberOrCallback; data?: any[]; dataComponent?: React.ReactElement; endAngle?: number; @@ -58,7 +49,7 @@ export interface VictoryPieProps StringOrNumberOrCallback | string[] | number[] >[]; eventKey?: StringOrNumberOrCallback; - innerRadius?: innerRadiusType; + innerRadius?: NumberOrCallback; labelPosition?: labelPositionType | ((props: VictorySliceProps) => labelPositionType); labelRadius?: number | ((props: VictorySliceProps) => number); origin?: OriginType;