Skip to content

Commit 2653a72

Browse files
committed
more general highcharts check
1 parent b2e38c9 commit 2653a72

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

fixtures/components/highcharts/chart/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@
44
import * as React from 'react';
55
import { NonCancelableEventHandler } from '../../internal/events';
66

7+
class Highcharts {}
8+
79
namespace Highcharts {
810
export interface Point {
911
x: number;
1012
y: number;
1113
}
14+
15+
export type Group = readonly Point[];
1216
}
1317

1418
export interface ChartProps {
15-
onHighlight?: NonCancelableEventHandler<{ point: Highcharts.Point }>;
19+
callback(highcharts: Highcharts): void;
20+
onHighlight?: NonCancelableEventHandler<{ point: Highcharts.Point; group: Highcharts.Group }>;
1621
}
1722

1823
/**

src/components/object-definition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function getObjectDefinition(
2727
realType.flags & ts.TypeFlags.Number ||
2828
isArrayType(realType) ||
2929
realTypeName === 'HTMLElement' ||
30-
realTypeName === 'Highcharts.Point' ||
30+
realTypeName.split('.')[0] === 'Highcharts' ||
3131
type === 'React.ReactNode'
3232
) {
3333
// do not expand built-in Javascript methods or primitive values

test/components/__snapshots__/highcharts.test.ts.snap

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ exports[`should not expand highcharts types 1`] = `
1111
"deprecatedTag": undefined,
1212
"description": undefined,
1313
"detailInlineType": {
14-
"name": "{ point: Highcharts.Point; }",
14+
"name": "{ point: Highcharts.Point; group: Highcharts.Group; }",
1515
"properties": [
16+
{
17+
"name": "group",
18+
"optional": false,
19+
"type": "Highcharts.Group",
20+
},
1621
{
1722
"name": "point",
1823
"optional": false,
@@ -21,14 +26,38 @@ exports[`should not expand highcharts types 1`] = `
2126
],
2227
"type": "object",
2328
},
24-
"detailType": "{ point: Highcharts.Point; }",
29+
"detailType": "{ point: Highcharts.Point; group: Highcharts.Group; }",
2530
"name": "onHighlight",
2631
"systemTags": undefined,
2732
},
2833
],
2934
"functions": [],
3035
"name": "Chart",
31-
"properties": [],
36+
"properties": [
37+
{
38+
"analyticsTag": undefined,
39+
"defaultValue": undefined,
40+
"deprecatedTag": undefined,
41+
"description": undefined,
42+
"i18nTag": undefined,
43+
"inlineType": {
44+
"name": "(highcharts: Highcharts) => void",
45+
"parameters": [
46+
{
47+
"name": "highcharts",
48+
"type": "Highcharts",
49+
},
50+
],
51+
"returnType": "void",
52+
"type": "function",
53+
},
54+
"name": "callback",
55+
"optional": false,
56+
"systemTags": undefined,
57+
"type": "(highcharts: Highcharts) => void",
58+
"visualRefreshTag": undefined,
59+
},
60+
],
3261
"regions": [],
3362
"releaseStatus": "stable",
3463
"systemTags": undefined,

0 commit comments

Comments
 (0)