diff --git a/packages/victory/src/index.d.ts b/packages/victory/src/index.d.ts deleted file mode 100644 index 743667f3d..000000000 --- a/packages/victory/src/index.d.ts +++ /dev/null @@ -1,282 +0,0 @@ -// TODO: Add missing type definitions for all import/export -// items that are commented out. - -declare module "victory" { - import { - Arc, - ArcProps, - Background, - BackgroundProps, - Border, - BorderProps, - Border as Box, - BorderProps as BoxProps, - ClipPath, - ClipPathProps, - LineSegment, - LineSegmentProps, - Whisker, - WhiskerProps, - Circle, - Rect, - Line, - Path, - TSpan, - Text, - TextProps, - Point, - PointProps, - VictoryAnimation, - VictoryAnimationProps, - VictoryContainer, - VictoryContainerProps, - VictoryLabel, - VictoryLabelProps, - VictoryTheme, - VictoryThemeDefinition, - // VictoryTransition, - VictoryPortal, - VictoryPortalProps, - Portal, - VictoryClipContainer, - VictoryClipContainerProps, - // addEvents, - // Collection, - // Data, - // DefaultTransitions, - // Domain, - // Events, - // Helpers, - // Log, - // PropTypes, - // Scale, - // Style, - TextSize, - // Transitions, - Selection, - // LabelHelpers, - // Axis, - // Wrapper - } from "victory-core"; - - import { VictoryChart, VictoryChartProps } from "victory-chart"; - import { VictoryGroup, VictoryGroupProps } from "victory-group"; - import { VictoryStack, VictoryStackProps } from "victory-stack"; - import { VictoryPie, Slice, VictoryPieProps, SliceProps } from "victory-pie"; - import { VictoryArea, Area, VictoryAreaProps, AreaProps } from "victory-area"; - import { VictoryBar, Bar, VictoryBarProps, BarProps } from "victory-bar"; - - import { - VictoryCandlestick, - VictoryCandlestickProps, - Candle, - CandleProps, - } from "victory-candlestick"; - import { - VictoryErrorBar, - ErrorBar, - VictoryErrorBarProps, - ErrorBarProps, - } from "victory-errorbar"; - - import { - VictoryLine, - Curve, - VictoryLineProps, - CurveProps, - } from "victory-line"; - import { VictoryHistogram, VictoryHistogramProps } from "victory-histogram"; - import { VictoryScatter, VictoryScatterProps } from "victory-scatter"; - import { VictoryBoxPlot, VictoryBoxPlotProps } from "victory-box-plot"; - import { VictoryBrushLine, VictoryBrushLineProps } from "victory-brush-line"; - import { - Voronoi, - VictoryVoronoi, - VoronoiProps, - VictoryVoronoiProps, - } from "victory-voronoi"; - - import { - VictoryBrushContainer, - VictoryBrushContainerProps, - // BrushHelpers, - // brushContainerMixin - } from "victory-brush-container"; - import { - VictoryCursorContainer, - VictoryCursorContainerProps, - // CursorHelpers, - // cursorContainerMixin - } from "victory-cursor-container"; - - // import { - // VictorySelectionContainer, - // SelectionHelpers, - // selectionContainerMixin - // } from "victory-selection-container"; - - import { - VictoryVoronoiContainer, - VictoryVoronoiContainerProps, - // VoronoiHelpers, - // voronoiContainerMixin - } from "victory-voronoi-container"; - import { - VictoryZoomContainer, - VictoryZoomContainerProps, - // ZoomHelpers, - // zoomContainerMixin, - // RawZoomHelpers - } from "victory-zoom-container"; - import { - // combineContainerMixins, - // makeCreateContainerFunction, - createContainer, - } from "victory-create-container"; - - import { - VictoryTooltip, - Flyout, - VictoryTooltipProps, - FlyoutProps, - } from "victory-tooltip"; - import { VictoryLegend, VictoryLegendProps } from "victory-legend"; - - // import { VictorySharedEvents } from "victory-shared-events"; - - import { VictoryAxis, VictoryAxisProps } from "victory-axis"; - import { VictoryPolarAxis, VictoryPolarAxisProps } from "victory-polar-axis"; - - export { - Arc, - ArcProps, - Area, - AreaProps, - Background, - BackgroundProps, - Bar, - BarProps, - Border, - BorderProps, - Box, - BoxProps, - Candle, - CandleProps, - ClipPath, - ClipPathProps, - Curve, - CurveProps, - ErrorBar, - ErrorBarProps, - LineSegment, - LineSegmentProps, - Point, - PointProps, - Slice, - SliceProps, - Voronoi, - VoronoiProps, - Flyout, - FlyoutProps, - Whisker, - WhiskerProps, - Circle, - Rect, - Line, - Path, - TSpan, - Text, - TextProps, - VictoryAnimation, - VictoryAnimationProps, - VictoryArea, - VictoryAreaProps, - VictoryAxis, - VictoryAxisProps, - VictoryPolarAxis, - VictoryPolarAxisProps, - VictoryBar, - VictoryBarProps, - VictoryBoxPlot, - VictoryBoxPlotProps, - VictoryCandlestick, - VictoryCandlestickProps, - VictoryChart, - VictoryChartProps, - VictoryErrorBar, - VictoryErrorBarProps, - VictoryHistogram, - VictoryHistogramProps, - VictoryGroup, - VictoryGroupProps, - VictoryLine, - VictoryLineProps, - VictoryLabel, - VictoryLabelProps, - VictoryLegend, - VictoryLegendProps, - VictoryPie, - VictoryPieProps, - VictoryScatter, - VictoryScatterProps, - VictoryStack, - VictoryStackProps, - VictoryTheme, - VictoryThemeDefinition, - // VictoryTransition, - // VictorySharedEvents, - VictoryTooltip, - VictoryTooltipProps, - VictoryVoronoi, - VictoryVoronoiProps, - VictoryPortal, - VictoryPortalProps, - Portal, - VictoryContainer, - VictoryContainerProps, - VictoryClipContainer, - VictoryClipContainerProps, - VictoryZoomContainer, - VictoryZoomContainerProps, - // ZoomHelpers, - // zoomContainerMixin, - // RawZoomHelpers, - // VictorySelectionContainer, - // SelectionHelpers, - // selectionContainerMixin, - VictoryBrushContainer, - VictoryBrushContainerProps, - // BrushHelpers, - // brushContainerMixin, - VictoryCursorContainer, - VictoryCursorContainerProps, - // CursorHelpers, - // cursorContainerMixin, - VictoryVoronoiContainer, - VictoryVoronoiContainerProps, - // VoronoiHelpers, - // voronoiContainerMixin, - // combineContainerMixins, - // makeCreateContainerFunction, - createContainer, - VictoryBrushLine, - VictoryBrushLineProps, - // addEvents, - // Collection, - // Data, - // DefaultTransitions, - // Domain, - // Events, - // Helpers, - // Log, - // PropTypes, - // Scale, - // Style, - TextSize, - // Transitions, - Selection, - // LabelHelpers, - // Axis, - // Wrapper - }; -} diff --git a/packages/victory/src/index.js b/packages/victory/src/index.ts similarity index 76% rename from packages/victory/src/index.js rename to packages/victory/src/index.ts index 97d25fb0c..42ac6d293 100644 --- a/packages/victory/src/index.js +++ b/packages/victory/src/index.ts @@ -57,32 +57,45 @@ export { VictoryVoronoi, Voronoi } from "victory-voronoi"; export { VictoryBrushLine } from "victory-brush-line"; export { VictoryBrushContainer, + // @ts-expect-error Missing types for this export BrushHelpers, + // @ts-expect-error Missing types for this export brushContainerMixin, } from "victory-brush-container"; export { VictoryCursorContainer, + // @ts-expect-error Missing types for this export CursorHelpers, + // @ts-expect-error Missing types for this export cursorContainerMixin, } from "victory-cursor-container"; export { VictorySelectionContainer, + // @ts-expect-error Missing types for this export SelectionHelpers, + // @ts-expect-error Missing types for this export selectionContainerMixin, } from "victory-selection-container"; export { VictoryVoronoiContainer, + // @ts-expect-error Missing types for this export VoronoiHelpers, + // @ts-expect-error Missing types for this export voronoiContainerMixin, } from "victory-voronoi-container"; export { VictoryZoomContainer, + // @ts-expect-error Missing types for this export ZoomHelpers, + // @ts-expect-error Missing types for this export zoomContainerMixin, + // @ts-expect-error Missing types for this export RawZoomHelpers, } from "victory-zoom-container"; export { + // @ts-expect-error Missing types for this export combineContainerMixins, + // @ts-expect-error Missing types for this export makeCreateContainerFunction, createContainer, } from "victory-create-container"; @@ -97,5 +110,6 @@ export { CanvasCurve, CanvasPoint, CanvasBar, + // @ts-expect-error Missing types for this export useCanvasContext, } from "victory-canvas"; diff --git a/packages/victory/src/victory.test.js b/packages/victory/src/victory.test.js deleted file mode 100644 index 47e5f2e66..000000000 --- a/packages/victory/src/victory.test.js +++ /dev/null @@ -1,254 +0,0 @@ -import * as Victory from "victory"; - -describe("victory", () => { - describe("exports victory components", () => { - it("exports VictoryAnimation", () => { - expect(Victory.VictoryAnimation).toBeDefined(); - }); - it("exports VictoryArea", () => { - expect(Victory.VictoryArea).toBeDefined(); - }); - it("exports VictoryAxis", () => { - expect(Victory.VictoryAxis).toBeDefined(); - }); - it("exports VictoryBar", () => { - expect(Victory.VictoryBar).toBeDefined(); - }); - it("exports VictoryBoxPlot", () => { - expect(Victory.VictoryBoxPlot).toBeDefined(); - }); - it("exports VictoryBrushContainer", () => { - expect(Victory.VictoryBrushContainer).toBeDefined(); - }); - it("exports VictoryBrushLine", () => { - expect(Victory.VictoryBrushLine).toBeDefined(); - }); - it("exports VictoryCandlestick", () => { - expect(Victory.VictoryCandlestick).toBeDefined(); - }); - it("exports VictoryChart", () => { - expect(Victory.VictoryChart).toBeDefined(); - }); - it("exports VictoryClipContainer", () => { - expect(Victory.VictoryClipContainer).toBeDefined(); - }); - it("exports VictoryContainer", () => { - expect(Victory.VictoryContainer).toBeDefined(); - }); - it("exports VictoryCursorContainer", () => { - expect(Victory.VictoryCursorContainer).toBeDefined(); - }); - it("exports VictoryErrorBar", () => { - expect(Victory.VictoryErrorBar).toBeDefined(); - }); - it("exports VictoryGroup", () => { - expect(Victory.VictoryGroup).toBeDefined(); - }); - it("exports VictoryLabel", () => { - expect(Victory.VictoryLabel).toBeDefined(); - }); - it("exports VictoryLegend", () => { - expect(Victory.VictoryLegend).toBeDefined(); - }); - it("exports VictoryLine", () => { - expect(Victory.VictoryLine).toBeDefined(); - }); - it("exports VictoryPie", () => { - expect(Victory.VictoryPie).toBeDefined(); - }); - it("exports VictoryPolarAxis", () => { - expect(Victory.VictoryPolarAxis).toBeDefined(); - }); - it("exports VictoryPortal", () => { - expect(Victory.VictoryPortal).toBeDefined(); - }); - it("exports VictoryScatter", () => { - expect(Victory.VictoryScatter).toBeDefined(); - }); - it("exports VictorySelectionContainer", () => { - expect(Victory.VictorySelectionContainer).toBeDefined(); - }); - it("exports VictorySharedEvents", () => { - expect(Victory.VictorySharedEvents).toBeDefined(); - }); - it("exports VictoryStack", () => { - expect(Victory.VictoryStack).toBeDefined(); - }); - it("exports VictoryTheme", () => { - expect(Victory.VictoryTheme).toBeDefined(); - }); - it("exports VictoryTransition", () => { - expect(Victory.VictoryTransition).toBeDefined(); - }); - it("exports VictoryTooltip", () => { - expect(Victory.VictoryTooltip).toBeDefined(); - }); - it("exports VictoryVoronoi", () => { - expect(Victory.VictoryVoronoi).toBeDefined(); - }); - it("exports VictoryVoronoiContainer", () => { - expect(Victory.VictoryVoronoiContainer).toBeDefined(); - }); - it("exports VictoryZoomContainer", () => { - expect(Victory.VictoryZoomContainer).toBeDefined(); - }); - }); - describe("exports primitive components", () => { - // eslint-disable-line max-statements - it("exports Area", () => { - expect(Victory.Area).toBeDefined(); - }); - it("exports Bar", () => { - expect(Victory.Bar).toBeDefined(); - }); - it("exports Border", () => { - expect(Victory.Border).toBeDefined(); - }); - it("exports Candle", () => { - expect(Victory.Candle).toBeDefined(); - }); - it("exports Circle", () => { - expect(Victory.Circle).toBeDefined(); - }); - it("exports ClipPath", () => { - expect(Victory.ClipPath).toBeDefined(); - }); - it("exports Curve", () => { - expect(Victory.Curve).toBeDefined(); - }); - it("exports ErrorBar", () => { - expect(Victory.ErrorBar).toBeDefined(); - }); - it("exports Flyout", () => { - expect(Victory.Flyout).toBeDefined(); - }); - it("exports LineSegment", () => { - expect(Victory.LineSegment).toBeDefined(); - }); - it("exports Line", () => { - expect(Victory.Line).toBeDefined(); - }); - it("exports Path", () => { - expect(Victory.Path).toBeDefined(); - }); - it("exports Point", () => { - expect(Victory.Point).toBeDefined(); - }); - it("exports Rect", () => { - expect(Victory.Rect).toBeDefined(); - }); - it("exports Slice", () => { - expect(Victory.Slice).toBeDefined(); - }); - it("exports Text", () => { - expect(Victory.Text).toBeDefined(); - }); - it("exports TSpan", () => { - expect(Victory.TSpan).toBeDefined(); - }); - it("exports Voronoi", () => { - expect(Victory.Voronoi).toBeDefined(); - }); - it("exports Whisker", () => { - expect(Victory.Whisker).toBeDefined(); - }); - }); - describe("exports helper components", () => { - it("exports addEvents", () => { - expect(Victory.addEvents).toBeDefined(); - }); - it("exports Axis", () => { - expect(Victory.Axis).toBeDefined(); - }); - it("exports brushContainerMixin", () => { - expect(Victory.brushContainerMixin).toBeDefined(); - }); - it("exports BrushHelpers", () => { - expect(Victory.BrushHelpers).toBeDefined(); - }); - it("exports Collection", () => { - expect(Victory.Collection).toBeDefined(); - }); - it("exports combineContainerMixins", () => { - expect(Victory.combineContainerMixins).toBeDefined(); - }); - it("exports createContainer", () => { - expect(Victory.createContainer).toBeDefined(); - }); - it("exports cursorContainerMixin", () => { - expect(Victory.cursorContainerMixin).toBeDefined(); - }); - it("exports CursorHelpers", () => { - expect(Victory.CursorHelpers).toBeDefined(); - }); - it("exports Data", () => { - expect(Victory.Data).toBeDefined(); - }); - it("exports DefaultTransitions", () => { - expect(Victory.DefaultTransitions).toBeDefined(); - }); - it("exports Domain", () => { - expect(Victory.Domain).toBeDefined(); - }); - it("exports Events", () => { - expect(Victory.Events).toBeDefined(); - }); - it("exports Helpers", () => { - expect(Victory.Helpers).toBeDefined(); - }); - it("exports LabelHelpers", () => { - expect(Victory.LabelHelpers).toBeDefined(); - }); - it("exports Log", () => { - expect(Victory.Log).toBeDefined(); - }); - it("exports makeCreateContainerFunction", () => { - expect(Victory.makeCreateContainerFunction).toBeDefined(); - }); - it("exports Portal", () => { - expect(Victory.Portal).toBeDefined(); - }); - it("exports PropTypes", () => { - expect(Victory.PropTypes).toBeDefined(); - }); - it("exports RawZoomHelpers", () => { - expect(Victory.RawZoomHelpers).toBeDefined(); - }); - it("exports Scale", () => { - expect(Victory.Scale).toBeDefined(); - }); - it("exports Selection", () => { - expect(Victory.Selection).toBeDefined(); - }); - it("exports selectionContainerMixin", () => { - expect(Victory.selectionContainerMixin).toBeDefined(); - }); - it("exports SelectionHelpers", () => { - expect(Victory.SelectionHelpers).toBeDefined(); - }); - it("exports Style", () => { - expect(Victory.Style).toBeDefined(); - }); - it("exports TextSize", () => { - expect(Victory.TextSize).toBeDefined(); - }); - it("exports Transitions", () => { - expect(Victory.Transitions).toBeDefined(); - }); - it("exports voronoiContainerMixin", () => { - expect(Victory.voronoiContainerMixin).toBeDefined(); - }); - it("exports VoronoiHelpers", () => { - expect(Victory.VoronoiHelpers).toBeDefined(); - }); - it("exports Wrapper", () => { - expect(Victory.Wrapper).toBeDefined(); - }); - it("exports zoomContainerMixin", () => { - expect(Victory.zoomContainerMixin).toBeDefined(); - }); - it("exports ZoomHelpers", () => { - expect(Victory.ZoomHelpers).toBeDefined(); - }); - }); -}); diff --git a/packages/victory/src/victory.test.ts b/packages/victory/src/victory.test.ts new file mode 100644 index 000000000..f27a4ee0d --- /dev/null +++ b/packages/victory/src/victory.test.ts @@ -0,0 +1,198 @@ +import { omit } from "lodash"; +import * as Victory from "victory"; +import { + Area, + Axis, + Background, + Bar, + Border, + Box, + BrushHelpers, + Candle, + CanvasBar, + CanvasCurve, + CanvasGroup, + CanvasPoint, + Circle, + ClipPath, + Collection, + CursorHelpers, + Curve, + Data, + DefaultTransitions, + Domain, + ErrorBar, + Events, + Flyout, + Helpers, + LabelHelpers, + Line, + LineSegment, + Log, + Path, + Point, + Portal, + PropTypes, + RawZoomHelpers, + Rect, + Scale, + Selection, + SelectionHelpers, + Slice, + Style, + TSpan, + Text, + TextSize, + Transitions, + UserProps, + VictoryAccessibleGroup, + VictoryAnimation, + VictoryArea, + VictoryAxis, + VictoryBar, + VictoryBoxPlot, + VictoryBrushContainer, + VictoryBrushLine, + VictoryCandlestick, + VictoryChart, + VictoryClipContainer, + VictoryContainer, + VictoryCursorContainer, + VictoryErrorBar, + VictoryGroup, + VictoryHistogram, + VictoryLabel, + VictoryLegend, + VictoryLine, + VictoryPie, + VictoryPolarAxis, + VictoryPortal, + VictoryScatter, + VictorySelectionContainer, + VictorySharedEvents, + VictoryStack, + VictoryTheme, + VictoryTooltip, + VictoryTransition, + VictoryVoronoi, + VictoryVoronoiContainer, + VictoryZoomContainer, + Voronoi, + VoronoiHelpers, + Whisker, + Wrapper, + ZoomHelpers, + addEvents, + brushContainerMixin, + combineContainerMixins, + createContainer, + cursorContainerMixin, + makeCreateContainerFunction, + selectionContainerMixin, + useCanvasContext, + voronoiContainerMixin, + zoomContainerMixin, +} from "victory"; + +describe("victory", () => { + it("ensure it has named exports", () => { + expect(Area).toBeInstanceOf(Function); + }); + it("ensure everything is exported correctly", () => { + expect(Object.keys(Victory)).toMatchInlineSnapshot(` + Array [ + "Area", + "Axis", + "Background", + "Bar", + "Border", + "Box", + "BrushHelpers", + "Candle", + "CanvasBar", + "CanvasCurve", + "CanvasGroup", + "CanvasPoint", + "Circle", + "ClipPath", + "Collection", + "CursorHelpers", + "Curve", + "Data", + "DefaultTransitions", + "Domain", + "ErrorBar", + "Events", + "Flyout", + "Helpers", + "LabelHelpers", + "Line", + "LineSegment", + "Log", + "Path", + "Point", + "Portal", + "PropTypes", + "RawZoomHelpers", + "Rect", + "Scale", + "Selection", + "SelectionHelpers", + "Slice", + "Style", + "TSpan", + "Text", + "TextSize", + "Transitions", + "UserProps", + "VictoryAccessibleGroup", + "VictoryAnimation", + "VictoryArea", + "VictoryAxis", + "VictoryBar", + "VictoryBoxPlot", + "VictoryBrushContainer", + "VictoryBrushLine", + "VictoryCandlestick", + "VictoryChart", + "VictoryClipContainer", + "VictoryContainer", + "VictoryCursorContainer", + "VictoryErrorBar", + "VictoryGroup", + "VictoryHistogram", + "VictoryLabel", + "VictoryLegend", + "VictoryLine", + "VictoryPie", + "VictoryPolarAxis", + "VictoryPortal", + "VictoryScatter", + "VictorySelectionContainer", + "VictorySharedEvents", + "VictoryStack", + "VictoryTheme", + "VictoryTooltip", + "VictoryTransition", + "VictoryVoronoi", + "VictoryVoronoiContainer", + "VictoryZoomContainer", + "Voronoi", + "VoronoiHelpers", + "Whisker", + "Wrapper", + "ZoomHelpers", + "addEvents", + "brushContainerMixin", + "combineContainerMixins", + "createContainer", + "cursorContainerMixin", + "makeCreateContainerFunction", + "selectionContainerMixin", + "useCanvasContext", + "voronoiContainerMixin", + "zoomContainerMixin", + ] + `); + }); +});