Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions fixtures/components/highcharts/chart/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import * as React from 'react';
import { NonCancelableEventHandler } from '../../internal/events';

class Highcharts {}

namespace Highcharts {
export interface Point {
x: number;
y: number;
}

export type Group = readonly Point[];
}

export interface ChartProps {
callback(highcharts: Highcharts): void;
onHighlight?: NonCancelableEventHandler<{ point: Highcharts.Point; group: Highcharts.Group }>;
}

/**
* Chart description
*/
export default function Chart({ onHighlight }: ChartProps) {
return (
<svg>
<div onMouseOver={() => onHighlight?.({ detail: { point: { x: 0, y: 0 } } })}></div>
</svg>
);
}
4 changes: 4 additions & 0 deletions fixtures/components/highcharts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../tsconfig.json",
"include": ["./**/*.tsx"]
}
1 change: 1 addition & 0 deletions src/components/object-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function getObjectDefinition(
realType.flags & ts.TypeFlags.Number ||
isArrayType(realType) ||
realTypeName === 'HTMLElement' ||
realTypeName.split('.')[0] === 'Highcharts' ||
type === 'React.ReactNode'
) {
// do not expand built-in Javascript methods or primitive values
Expand Down
66 changes: 66 additions & 0 deletions test/components/__snapshots__/highcharts.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`should not expand highcharts types 1`] = `
[
{
"dashCaseName": "chart",
"description": "Chart description",
"events": [
{
"cancelable": false,
"deprecatedTag": undefined,
"description": undefined,
"detailInlineType": {
"name": "{ point: Highcharts.Point; group: Highcharts.Group; }",
"properties": [
{
"name": "group",
"optional": false,
"type": "Highcharts.Group",
},
{
"name": "point",
"optional": false,
"type": "Highcharts.Point",
},
],
"type": "object",
},
"detailType": "{ point: Highcharts.Point; group: Highcharts.Group; }",
"name": "onHighlight",
"systemTags": undefined,
},
],
"functions": [],
"name": "Chart",
"properties": [
{
"analyticsTag": undefined,
"defaultValue": undefined,
"deprecatedTag": undefined,
"description": undefined,
"i18nTag": undefined,
"inlineType": {
"name": "(highcharts: Highcharts) => void",
"parameters": [
{
"name": "highcharts",
"type": "Highcharts",
},
],
"returnType": "void",
"type": "function",
},
"name": "callback",
"optional": false,
"systemTags": undefined,
"type": "(highcharts: Highcharts) => void",
"visualRefreshTag": undefined,
},
],
"regions": [],
"releaseStatus": "stable",
"systemTags": undefined,
},
]
`;
10 changes: 10 additions & 0 deletions test/components/highcharts.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { expect, test } from 'vitest';
import { buildProject } from './test-helpers';

test('should not expand highcharts types', () => {
const result = buildProject('highcharts');
expect(result).toMatchSnapshot();
});
Loading