Definitelytyped: Missing optional value parameter in RechartsFunction

Created on 14 Sep 2017  路  6Comments  路  Source: DefinitelyTyped/DefinitelyTyped

In actual RechartsFunction type is missing optional value definition and can't use custom formatters for XAxis, YAxis etc.

Most helpful comment

It's propType is PropTypes.func, so that doesn't really help us either. It's invoked with a parameter named text, suggesting its input might be a String. But I wouldn't rely on that either.

So I think (value: any) => any is indeed the best we can do...

All 6 comments

Which formatters should be included in the definitions?
I.e. what is the signature of the methods you think are missing?
In the docs there is just mentioned function... (http://recharts.org/#/en-US/api/YAxis)

In my opinion it takes some kind of an object as parameter and has the same return type.

Maybe

tickFormatter: (value: any) => any;

is enough, but it could also be more specific.

@mthmulders and @royxue what do you think?

It's propType is PropTypes.func, so that doesn't really help us either. It's invoked with a parameter named text, suggesting its input might be a String. But I wouldn't rely on that either.

So I think (value: any) => any is indeed the best we can do...

@jetpack3331 Since the requested changes were included in the last merge, you could close this topic.

Thx @rapmue

I don't think this has been resolved. RechartsFunction is hiding parameter data in all the graphs in typescript at the moment. I am unable to use any mouse/click handlers to get graph data unless I override the RechartsFunction to take "value: any".

Example onClick for LineChart returns {activeCoordinate, activeLabel, activePayload, activeTooltipIndex, chartX, chartY} but the current typescript definitions prevent me from accessing this value parameter.

@tompuric In this issue the request was for formatters not callback functions. If you are unhappy with the current definitions, a pull request is appreciated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JudeAlquiza picture JudeAlquiza  路  3Comments

fasatrix picture fasatrix  路  3Comments

jbreckmckye picture jbreckmckye  路  3Comments

jrmcdona picture jrmcdona  路  3Comments

victor-guoyu picture victor-guoyu  路  3Comments