Label: `angle` prop is rejected by TypeScript
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
A fix for https://github.com/recharts/recharts/issues/2128 was already released but does not fix
angle
onLabel
Reproduction link
Steps to reproduce
<YAxis stroke="black">
<Label
angle={270}
position="left"
style={{
textAnchor: 'middle',
fill: "black",
}}
>
Sales ($)
</Label>
</YAxis>
What is expected?
angle
is accepted by TypeScript.
What is actually happening?
“Property angle
does not exist on type …”
The rendered label is rotated. This is purely an issue at the type level.
Environment | Info |
---|---|
Recharts | v2.0.3 |
React | 16.14.0 |
System | Ubuntu 20.04 |
Browser | Chrome 87 |
Update: Use real-world example by default since an isolated usage of <Label />
was confusing.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Reject parameters in a function that have specific type in a prop
The safer option for TS is to disallow using onPressIcon until you check the type property. type TextInput = { type: 'password'; ...
Read more >TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >Angular unit testing tutorial with examples - LogRocket Blog
This tutorial demonstrates how to build an Angular app and write a unit test, test an async operator, and automatically generate a unit ......
Read more >Media Capture and Streams - W3C
This document defines a set of JavaScript APIs that allow local media, including audio and video, to be requested from a platform.
Read more >Node.js v19.3.0 Documentation
profileEnd([label]); console. ... node:crypto module methods and properties ... rawListeners(eventName); emitter[Symbol.for('nodejs.rejection')](err, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t want to use a
Text
component since I’m using theLabel
inside an axis component. TheLabel
inside anAxis
does implement theangle
prop but TypeScript is rejecting that prop. Does this clarify the issue for you?Me too. Currently I’m just ignoring the error with ‘// @ts-ignore’ and are happy that its still works as expected.