Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PieProps ref using incorrect type definitions #2709

Open
1 task
HannesArni opened this issue Nov 9, 2021 · 2 comments
Open
1 task

PieProps ref using incorrect type definitions #2709

HannesArni opened this issue Nov 9, 2021 · 2 comments

Comments

@HannesArni
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Define the props for a Pie component in an object, and set the type of the object to PieProps. Then pass those properties to a Pie component, and you'll get a type error

What is expected?

The PieProps type should match the Pie component props

What is actually happening?

PieProps does not match Pie components props

Environment Info
Recharts v2.1.6
React 16.14.0
System macOS Big Sur 11.6
Browser Chrome 95.0.4638.69
@binhpv
Copy link

binhpv commented Dec 2, 2021

I second this issue. Probably related to #2665
The ref that the component exposed is the default class component ref, pointing to the instance of that component and not the DOM element.

@Sigkar
Copy link

Sigkar commented Jan 14, 2022

Ran into this issue creating a library component wrapper for a line chart.

A quick fix for this i've been using is to Omit the type value for ref and add a generic/typed ref in its place, like, and just throwing some basic idea out:

Omit<PieProps, 'ref'> & Record<'ref', React.Ref<any>>;

Also affects LineProps for those wondering. Might be an issue in more than those two places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants