0.10.1 • Published 1 year ago

highcharts-declarations-beta v0.10.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
1 year ago

TypeScript Declarations (Beta) for Highcharts v6

These declaration files are in a beta state and incomplete. They are not necessary for Highcharts v7. Even though the type definitions help in developing Highcharts-based solutions in TypeScript, in some circumstances a partial cast to the any type is necessary because of missing declarations.

This beta version contains declarations for the following imports:

  • highcharts
  • highcharts/highcharts-3d
  • highcharts/highcharts-more
  • highcharts/highmaps
  • highcharts/highstock
  • highcharts/indicators/*
  • highcharts/modules/*

Requirements

You have to install Highcharts before installing the declarations, use the following command:

npm install highcharts@6.2

Install, update & uninstall

  • To install or update this package add it to your package.json using the npm alias feature.
  { 
    "@types/highcharts" : "npm:highcharts-declarations-beta:<version>"
  }

Configuration

There is no extra configuration required. TypeScript will automatically detect the declaration files in the highcharts module.

Workaround for missing declarations

To combine these existing declarations with missing ones, you have to cast modules and unknown functions to the any type. At first you have to create a 'global.d.ts' file in your root folder with the following file content:

declare module '*';

Now you can use all JavaScript modules and cast the Highcharts namespace as required. For example:

import * as Highcharts from 'highcharts';
// Module with declaration:
import AccessibilityModule from 'highcharts/modules/accessibility';
// Module with any type:
import NewModule from 'highcharts/modules/new';

NewModule(Highcharts);
AccessibilityModule(Highcharts);

// Initiate the chart
(Highcharts as any).newChart('container', {

    series: [{
        type: 'new',
        data: [1, 2, 3, 4, 5]
    }]

});
0.10.1

1 year ago

0.10.0

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.9.0

1 year ago