Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing DefinitelyTyped props to VictorySlice and VictoryPie #1538

Merged
merged 2 commits into from
Apr 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions packages/victory-pie/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -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
| ((
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should get the full list of VictoySliceProps like others

props: {
active?: boolean;
datum?: any;
}
) => number);

export interface VictorySliceProps extends VictoryCommonProps {
cornerRadius?: SliceNumberOrCallback<VictorySliceProps, "cornerRadius">;
datum?: any;
innerRadius?:
| number
| ((
props: {
active?: boolean;
datum?: any;
}
) => number);
innerRadius?: innerRadiusType;
padAngle?: SliceNumberOrCallback<VictorySliceProps, "padAngle">;
pathComponent?: React.ReactElement;
pathFunction?: (props: VictorySliceProps) => string;
Expand All @@ -35,22 +43,27 @@ export interface VictorySliceProps extends VictoryCommonProps {
sliceStartAngle?: SliceNumberOrCallback<VictorySliceProps, "sliceStartAngle">;
}

export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabelableProps {
export interface VictoryPieProps
extends VictoryCommonProps,
VictoryLabelableProps,
VictoryMultiLabelableProps {
categories?: CategoryPropType;
colorScale?: ColorScalePropType;
cornerRadius?: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cornerRadius should also take a function

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;
Expand Down