Skip to content

Commit f31823e

Browse files
committed
[FIX] ts: fix compiling of .d.ts files
It wasn't possible to compile the lib into `.d.ts` since 8a02a6b, error `... exported class expression may not be private or protected`.[1] It seems that we cannot have an anonymous class with private/protected methods. We had a similar issue with the `PivotPresentationLayer`. This commit adds explicit typing to the functions generating the funnel chart classes, so typescript doesn't try to infer types for them. [1]: see microsoft/TypeScript#30355 or microsoft/TypeScript#36060 Task: 0
1 parent 18651c2 commit f31823e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/figures/chart/chartJs/chartjs_funnel_chart.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import {
2+
BarController,
23
BarControllerChartOptions,
34
BarControllerDatasetOptions,
45
BarElement,
56
CartesianParsedData,
67
CartesianScaleTypeRegistry,
8+
Chart,
9+
ChartComponent,
710
TooltipPositionerFunction,
811
} from "chart.js";
12+
import { AnyObject } from "chart.js/dist/types/basic";
913

10-
export function getFunnelChartController() {
14+
export function getFunnelChartController(): ChartComponent & {
15+
prototype: BarController;
16+
new (chart: Chart, datasetIndex: number): BarController;
17+
} {
1118
return class FunnelChartController extends window.Chart?.BarController {
1219
static id = "funnel";
1320
static defaults = {
@@ -37,7 +44,10 @@ export function getFunnelChartController() {
3744
};
3845
}
3946

40-
export function getFunnelChartElement() {
47+
export function getFunnelChartElement(): ChartComponent & {
48+
prototype: BarElement;
49+
new (cfg: AnyObject): BarElement;
50+
} {
4151
/**
4252
* Similar to a bar chart element, but it's a trapezoid rather than a rectangle. The top is of width
4353
* `width`, and the bottom is of width `nextElementWidth`.

0 commit comments

Comments
 (0)