Skip to content

Commit 44695f4

Browse files
authored
Merge pull request #338 from veloek/highstock_types
Add typescript definitions for react-jsx-highstock
2 parents e006035 + 3bb64ef commit 44695f4

File tree

4 files changed

+121
-2
lines changed

4 files changed

+121
-2
lines changed

packages/react-jsx-highstock/package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-jsx-highstock/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
"description": "Highcharts (including Highstock) charts built using React components",
55
"main": "dist/react-jsx-highstock.min.js",
66
"module": "dist/es/index.js",
7+
"types": "types/index.d.ts",
78
"sideEffects": false,
89
"files": [
910
"dist",
10-
"src"
11+
"src",
12+
"types"
1113
],
1214
"scripts": {
1315
"build": "cross-env NODE_ENV=development webpack",
@@ -18,7 +20,8 @@
1820
"format": "prettier --write \"src/**/*.js\" \"test/**/*.js\" README.md",
1921
"lint": "eslint src",
2022
"test": "jest",
21-
"test:coverage": "jest --coverage"
23+
"test:coverage": "jest --coverage",
24+
"test:types": "tsc --noEmit"
2225
},
2326
"author": "Will Hawker",
2427
"contributors": [
@@ -70,6 +73,7 @@
7073
"@babel/preset-env": "^7.14.5",
7174
"@babel/preset-react": "^7.14.5",
7275
"@testing-library/react": "^11.2.7",
76+
"@types/react": "^17.0.11",
7377
"babel-eslint": "^10.1.0",
7478
"babel-loader": "^8.2.2",
7579
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
@@ -89,6 +93,7 @@
8993
"react": "^17.0.2",
9094
"react-dom": "^17.0.2",
9195
"rimraf": "^3.0.2",
96+
"typescript": "^4.3.2",
9297
"webpack": "^5.38.1",
9398
"webpack-cli": "^4.7.2"
9499
},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"moduleResolution": "node",
4+
"noImplicitAny": true,
5+
"target": "ES2020"
6+
},
7+
"include": ["./types/**/*"]
8+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import type * as Highcharts from 'highcharts';
2+
import type { ReactElement, ReactNode } from 'react';
3+
import { HighchartsChartProps, SeriesProps } from 'react-jsx-highcharts';
4+
5+
export * from 'react-jsx-highcharts';
6+
7+
export function HighchartsStockChart(props: HighchartsChartProps): ReactElement;
8+
9+
// Navigator
10+
type NavigatorProps = {
11+
children?: ReactNode;
12+
} & Partial<Highcharts.NavigatorOptions>;
13+
export function Navigator(props: NavigatorProps): ReactElement;
14+
export namespace Navigator {
15+
type NavigatorSeriesProps = {
16+
seriesId: string
17+
}
18+
export function Series(props: NavigatorSeriesProps): ReactElement;
19+
20+
type NavigatorXAxisProps = {
21+
children?: ReactNode
22+
} & Partial<Highcharts.NavigatorXAxisOptions>;
23+
export function XAxis(props: NavigatorXAxisProps): ReactElement;
24+
25+
type NavigatorYAxisProps = {
26+
children?: ReactNode
27+
} & Partial<Highcharts.NavigatorYAxisOptions>;
28+
export function YAxis(props: NavigatorYAxisProps): ReactElement;
29+
}
30+
31+
// RangeSelector
32+
type RangeSelectorProps = {
33+
children?: ReactNode;
34+
} & Partial<Highcharts.RangeSelectorOptions>;
35+
export function RangeSelector(
36+
props: RangeSelectorProps
37+
): ReactElement;
38+
export namespace RangeSelector {
39+
type RangeSelectorButtonProps = {
40+
children?: ReactNode;
41+
} & Partial<Omit<Highcharts.RangeSelectorButtonsOptions, "text">>;
42+
export function Button(props: RangeSelectorButtonProps): ReactElement;
43+
44+
type RangeSelectorInputProps = {
45+
boxBorderColor?: Highcharts.ColorString;
46+
boxHeight?: number;
47+
boxWidth?: (number|undefined);
48+
dateFormat?: string;
49+
dateParser?: Highcharts.RangeSelectorParseCallbackFunction;
50+
editDateFormat?: string;
51+
enabled?: boolean;
52+
position?: Highcharts.RangeSelectorInputPositionOptions;
53+
spacing?: number;
54+
style?: Highcharts.CSSObject;
55+
}
56+
export function Input(props: RangeSelectorInputProps): ReactElement;
57+
}
58+
59+
// Scrollbar
60+
export function Scrollbar(props: Highcharts.ScrollbarOptions): ReactElement;
61+
62+
// Series
63+
export function CandlestickSeries(
64+
props: SeriesProps<Highcharts.SeriesCandlestickOptions>
65+
): ReactElement;
66+
export function FlagsSeries(
67+
props: SeriesProps<Highcharts.SeriesFlagsOptions>
68+
): ReactElement;
69+
export function OHLCSeries(
70+
props: SeriesProps<Highcharts.SeriesOhlcOptions>
71+
): ReactElement;

0 commit comments

Comments
 (0)