Skip to content

Commit b6f48d8

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 X-original-commit: ce701a6
1 parent 84cef79 commit b6f48d8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
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

14+
<<<<<<< 84cef79e36efca340515d712fbdd272866be0d14
1015
export function getFunnelChartController() {
1116
return class FunnelChartController extends window.Chart.BarController {
17+
||||||| 18651c2be425faaaaad9871bf4a36c9acc9ec5aa
18+
export function getFunnelChartController() {
19+
return class FunnelChartController extends window.Chart?.BarController {
20+
=======
21+
export function getFunnelChartController(): ChartComponent & {
22+
prototype: BarController;
23+
new (chart: Chart, datasetIndex: number): BarController;
24+
} {
25+
return class FunnelChartController extends window.Chart?.BarController {
26+
>>>>>>> f31823e956a4a337ea91d1c1b8506284e8e2e372
1227
static id = "funnel";
1328
static defaults = {
1429
...window.Chart?.BarController.defaults,
@@ -37,7 +52,10 @@ export function getFunnelChartController() {
3752
};
3853
}
3954

40-
export function getFunnelChartElement() {
55+
export function getFunnelChartElement(): ChartComponent & {
56+
prototype: BarElement;
57+
new (cfg: AnyObject): BarElement;
58+
} {
4159
/**
4260
* Similar to a bar chart element, but it's a trapezoid rather than a rectangle. The top is of width
4361
* `width`, and the bottom is of width `nextElementWidth`.

0 commit comments

Comments
 (0)