mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Add createContainer function for victory (#33786)
* Add function createContainer for victory * Fix tests * Update types/victory/index.d.ts Change FunctionComponent to ComponentType Co-Authored-By: ibarrae <eibarra1992@hotmail.com>
This commit is contained in:
committed by
Wesley Wigham
parent
f447708212
commit
ec30451574
Vendored
+22
@@ -5,6 +5,8 @@
|
||||
// Krzysztof Cebula <https://github.com/Havret>
|
||||
// Vitaliy Polyanskiy <https://github.com/allreadyExisted>
|
||||
// James Lismore <https://github.com/jlismore>
|
||||
// Stack Builders <https://github.com/stackbuilders>
|
||||
// Esteban Ibarra <https://github.com/ibarrae>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -2424,4 +2426,24 @@ declare module "victory" {
|
||||
* Data changes are animated with VictoryAnimation.
|
||||
*/
|
||||
export class VictoryPie extends React.Component<VictoryPieProps, any> {}
|
||||
|
||||
export type ContainerType =
|
||||
| "brush"
|
||||
| "cursor"
|
||||
| "selection"
|
||||
| "voronoi"
|
||||
| "zoom";
|
||||
|
||||
/**
|
||||
* createContainer makes a container component with multiple behaviors.
|
||||
* It allows you to effectively combine any two of the following containers:
|
||||
* VictoryBrushContainer, VictoryCursorContainer, VictorySelectionContainer,
|
||||
* VictoryVoronoiContainer, or VictoryZoomContainer.
|
||||
* @param c1 : "brush" | "cursor" | "selection" | "voronoi" | "zoom"
|
||||
* @param c2 : "brush" | "cursor" | "selection" | "voronoi" | "zoom"
|
||||
*/
|
||||
export function createContainer<V, W>(
|
||||
c1: ContainerType,
|
||||
c2: ContainerType
|
||||
): React.ComponentType<V & W>;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"no-declare-current-package": false,
|
||||
"no-empty-interface": false,
|
||||
"no-single-declare-module": false,
|
||||
"strict-export-declare-modifiers": false
|
||||
"strict-export-declare-modifiers": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,10 @@ import {
|
||||
VictoryTheme,
|
||||
VictoryLegend,
|
||||
VictoryBoxPlot,
|
||||
VictoryGroup
|
||||
VictoryGroup,
|
||||
createContainer,
|
||||
VictoryZoomContainerProps,
|
||||
VictoryBrushContainerProps
|
||||
} from "victory";
|
||||
|
||||
// VictoryAnimation test
|
||||
@@ -804,3 +807,17 @@ test = (
|
||||
}]}
|
||||
/>
|
||||
);
|
||||
|
||||
// createContainer test
|
||||
|
||||
const VictoryZoomBrushContainer = createContainer<
|
||||
VictoryZoomContainerProps,
|
||||
VictoryBrushContainerProps
|
||||
>("zoom", "brush");
|
||||
|
||||
test = (
|
||||
<VictoryZoomBrushContainer
|
||||
brushDomain={[0, 500]}
|
||||
zoomDomain={[0, 500]}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user