Comments (25)
I created a types file for my personal use; hopefully it serves as a good starting point for someone to do so more formally (whether part of the package or in DefinitelyTyped). However, some work definitely needs to be done before Highstocks and Highmaps are covered.
It's short, so I'll just paste the contents @types/highcharts-react-official/index.d.ts
(where @types
is parallel to node_modules
).
declare module "highcharts-react-official" {
import * as React from "react";
import * as Highcharts from "highcharts";
/**
* Represents a "constructor" function for a ChartObject.
* Not technically a constructor, as it's not called with `new`.
*/
type Constructor = (
renderTo: HTMLElement,
options: Highcharts.Options,
) => Highcharts.ChartObject;
/**
* Represents all of the strings that are keys of T that map to a Constructor function.
*/
type ConstructorName<T> = {
[K in keyof T]: T[K] extends Constructor ? K : never
}[keyof T];
export interface HighchartsReactProps<TContainerProps = {}> {
highcharts?: Highcharts.Static;
constructorType?: ConstructorName<Highcharts.Static>;
update?: boolean;
options: Highcharts.Options;
containerProps?: TContainerProps;
}
export class HighchartsReact<TContainerProps = {}> extends React.Component<
HighchartsReactProps<TContainerProps>
> {}
export default HighchartsReact;
}
from highcharts-react.
Hi @JannesMeyer
For the wrapper?
If, for the Highcharts then please refer to this issue - highcharts/highcharts#4876
from highcharts-react.
Is there any ETA on this?
from highcharts-react.
Hello! We will also work on declarations for Highcharts React. Development will start with the end of the beta phase for Highcharts declarations.
from highcharts-react.
Hi @KacperMadej !
Yes, for the props of the HighchartsReact
component. (options
, highcharts
, constructorType
, etc...)
I see in the other issue that you are unable to provide type definitions for the options
, but you could already provide types for the other two props.
Of course, the main issue is adequate typing for the options
prop...
from highcharts-react.
By the way, the company I work for has a single developer license for the Highcharts Suite with the Premium Support.
Let me know if you want me to email the proof of license.
from highcharts-react.
For technical support please use support channels - https://www.highcharts.com/support
It would be for the best to keep issues in github for bugs - at least this it what we are trying to do.
from highcharts-react.
Ok, I have written an email to [email protected] requesting this enhancement.
Sorry for using the wrong channel.
from highcharts-react.
Not a problem. I'm keeping this issue open and labeled as an enhancement.
from highcharts-react.
See #36. Official definitions are expected in Q3.
from highcharts-react.
As specified in #36 the official definitions are only for the normal highcharts api. So we still need official definitions for highcharts-react.
from highcharts-react.
I agree with @TheJhonny007. Pull request #36 is only for the options attribute. Like I mentioned in my first comment, there would still be the need for types for the rest of the HighchartsReact
component.
from highcharts-react.
Sorry, I just realised that the rest of the component's types are included in the pull request. Nevermind!!
from highcharts-react.
@JannesMeyer in which pull request? #36 was rejected and closed.
from highcharts-react.
Thank you, that was the answer that I think we all wanted. 🙂
from highcharts-react.
No there is no ETA for this yet, because development has not started. First the Highcharts declerations have to be stable and generally available.
from highcharts-react.
I expect though that the support will be quite fast implemented, once the Highcharts declarations are leaving the beta state.
from highcharts-react.
@bre1470 thanks - my understanding for now is that I should follow the instructions @ https://github.com/highcharts/highcharts-declarations-beta plus the types from @BrandonWilliamsCS updated to use your beta types e.g.
Highcharts.ChartObject -> Highcharts.Chart
highcharts?: Highcharts.Static; -> highcharts?: typeof Highcharts;
Is that fair?
from highcharts-react.
@jonfreedman Yes, that sounds reasonable and should help in the meantime.
I just like to point out, that the beta of the Highcharts declarations is not intended for regular development use. You might have to change some code after a future beta update.
from highcharts-react.
Happy to change later but the good news is this is working right now.
from highcharts-react.
now that Highcharts 7 contains typescript definitions by default, any updates on this issue?
from highcharts-react.
declare module "highcharts-react-official" { import * as React from "react"; import * as Highcharts from "highcharts"; /** * Represents a "constructor" function for a ChartObject. * Not technically a constructor, as it's not called with `new`. */ type Constructor = ( renderTo: HTMLElement, options: Highcharts.Options, ) => Highcharts.ChartObject; /** * Represents all of the strings that are keys of T that map to a Constructor function. */ type ConstructorName<T> = { [K in keyof T]: T[K] extends Constructor ? K : never }[keyof T]; export interface HighchartsReactProps<TContainerProps = {}> { highcharts?: Highcharts.Static; constructorType?: ConstructorName<Highcharts.Static>; update?: boolean; options: Highcharts.Options; containerProps?: TContainerProps; } export class HighchartsReact<TContainerProps = {}> extends React.Component< HighchartsReactProps<TContainerProps> > {} export default HighchartsReact; }
@BrandonWilliamsCS this no longer works with Highcharts 7.
getting error saying Highcharts.ChartObject
and Highcharts.Static
do not exist
from highcharts-react.
@pdeva, Unfortunately, I don't use this actively use library any longer, so it won't be likely that I'll be taking a close look at v7.
It could be that there are other types that can be swapped in for Highcharts.ChartObject
and Highcharts.Static
, but it's also possible that v7 came with enough of an API change that the types I wrote are essentially incompatible.
from highcharts-react.
The TypeScript declarations for this wrapper have been added in verion 2.1.0.
Please report in case of any problems.
Best regards!
from highcharts-react.
I am seeing the following error:
node_modules/highcharts-react-official/dist/highcharts-react.min.d.ts
(51,29): An index signature parameter type must be 'string' or 'number'.
See https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#3.9.4
from highcharts-react.
Related Issues (20)
- Wrong Gantt Behaviour On Having Multiple Ids in Series Data. HOT 3
- Donut Chart invisible until after HMR HOT 3
- Rendering simple chart with React Testing Library fails (computes NaN values) HOT 2
- Runtime error when chart tries to update while hovering over a series HOT 4
- Usage in React, Grid lines not visible HOT 2
- Tooltip is going under axis-component HOT 8
- Chart values and options doesn't trigger re-render HOT 2
- Zones rendering issue after updating to [email protected] HOT 5
- Issue whille integrating packedbubble in react-highcharts HOT 15
- TypeError: Cannot read properties of undefined (reading 'length') HOT 1
- Plotbands added via API are not added to plotOptions HOT 2
- Next.js 14.1.0 Cannot read properties of undefined (reading 'document') HOT 2
- Add a react ref to each point HOT 4
- chart.update() refression with yAxis behavior HOT 23
- Unexpected series order when adding linkedTo series HOT 2
- Cannot read properties of undefined (reading 'forEach') HOT 4
- Server side rendering of React components HOT 2
- Issue with borderRadius object HOT 1
- i am unable to draw a Polar (Radar) chart HOT 2
- Is this the correct way to use the Boost module to improve performance? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highcharts-react.