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

Recharts 2.1.14: Typing error at DefaultTooltipContent.tsx:83. value and name could be undefined while it is not expected. #2999

Closed
1 task done
gabgagnon opened this issue Oct 7, 2022 · 3 comments
Labels
typescript PRs or Issues surrounding Types or TS refactoring

Comments

@gabgagnon
Copy link
Contributor

gabgagnon commented Oct 7, 2022

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

Reproduction link

https://github.com/recharts/recharts

Steps to reproduce

  • Install Recharts lib in a typescript project.
  • Use Tooltip from Recharts.
  • See the typing error.
  • Open src/component/DefaultTooltipContent.tsx in an IDE
  • See the typing error at DefaultTooltipContent.tsx:83 for value & name variables

What is expected?

The variables Value and Name should never be undefined at this state, but typescript seems to think it can still happen and create an error.

What is actually happening?

For the value variable
Argument of type 'TValue | undefined' is not assignable to parameter of type 'TValue'.
'TValue' could be instantiated with an arbitrary type which could be unrelated to 'TValue | undefined'.ts(2345)

For the name variable
Argument of type 'TName | undefined' is not assignable to parameter of type 'TName'.
'TName' could be instantiated with an arbitrary type which could be unrelated to 'TName | undefined'.

Environment Info
Recharts v2.1.14
React 18.2.0
System macOS Monterey
Browser Chrome

#2945

This file got recently updated in this PR: da6b9e2

@puerschel93
Copy link

Is it already fixed ? I faced the same issue but after installing recharts@latest the error was gone.

@ckifer
Copy link
Member

ckifer commented Dec 29, 2022

This part of the issue seems resolved though #3008 is still open. @gabgagnon Can you confirm that the latest allows you to use a tooltip without this specific error? I can't reproduce even with 2.1.14. Will close this once confirmed

@ckifer ckifer added typescript PRs or Issues surrounding Types or TS refactoring pending response Pending response from the issue requester labels Dec 29, 2022
@ckifer ckifer removed the pending response Pending response from the issue requester label Sep 17, 2023
@ckifer
Copy link
Member

ckifer commented Sep 17, 2023

This is fixed, closing

@ckifer ckifer closed this as completed Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript PRs or Issues surrounding Types or TS refactoring
Projects
None yet
Development

No branches or pull requests

3 participants