Ill-formatted TypeScript types prevent building (v2.0.9)
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
- Use the link above. Do not mind the Codesandbox errors, but instead just use its Export to ZIP and download the source.
- Run
npm install
- Run
tsc --build
What is expected?
The build should succeed. No output from TypeScript.
What is actually happening?
TypeScript gives errors:
node_modules/recharts/types/polar/Radar.d.ts:66:208 - error TS2304: Cannot find name 'P'.
66 radiusAxis: React.AriaAttributes & import("../util/types").DOMAttributesAdaptChildEvent<any, SVGElement> & Omit<React.SVGProps<SVGElement>, keyof import("../util/types").DOMAttributesAdaptChildEvent<P, T>> & import("./PolarRadiusAxis").PolarRadiusAxisProps & {
~
node_modules/recharts/types/polar/Radar.d.ts:66:211 - error TS2304: Cannot find name 'T'.
66 radiusAxis: React.AriaAttributes & import("../util/types").DOMAttributesAdaptChildEvent<any, SVGElement> & Omit<React.SVGProps<SVGElement>, keyof import("../util/types").DOMAttributesAdaptChildEvent<P, T>> & import("./PolarRadiusAxis").PolarRadiusAxisProps & {
~
node_modules/recharts/types/polar/Radar.d.ts:69:215 - error TS2304: Cannot find name 'P'.
69 angleAxis: React.AriaAttributes & import("../util/types").DOMAttributesAdaptChildEvent<any, SVGTextElement> & Omit<React.SVGProps<SVGTextElement>, keyof import("../util/types").DOMAttributesAdaptChildEvent<P, T>> & import("./PolarAngleAxis").PolarAngleAxisProps & {
~
node_modules/recharts/types/polar/Radar.d.ts:69:218 - error TS2304: Cannot find name 'T'.
69 angleAxis: React.AriaAttributes & import("../util/types").DOMAttributesAdaptChildEvent<any, SVGTextElement> & Omit<React.SVGProps<SVGTextElement>, keyof import("../util/types").DOMAttributesAdaptChildEvent<P, T>> & import("./PolarAngleAxis").PolarAngleAxisProps & {
Environment | Info |
---|---|
Recharts | v2.0.9 |
React | 17.0.1 |
System | WSL2/Ubuntu 20.04, Node 14.15.3, NPM 7.7.6, TypeScript 4.2.3 |
Browser | not applicable (NPM build error) |
In essence, TypeScript build will fail, unless I set the skipLibCheck
to true in tsconfig.json.
2.0.8 doesn’t produce this error. (But 2.0.8 uses a version of react-smooth that requires React < 17.)
In 2.0.8, the culprit rows used Pick<..., (a big list of string literals)>
, and now they use Omit<..., keyof import("../util/types").DOMAttributesAdaptChildEvent<P, T>>
, which doesn’t work as P
and T
are not defined.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:33
- Comments:9
Top Results From Across the Web
Documentation - Everyday Types - TypeScript
We'll start by reviewing the most basic and common types you might encounter when writing JavaScript or TypeScript code. These will later form...
Read more >Documentation - Advanced Types - TypeScript
Effectively, null and undefined are valid values of every type. That means it's not possible to stop them from being assigned to any...
Read more >Documentation - The Basics - TypeScript
Types for Tooling. TypeScript can catch bugs when we make mistakes in our code. That's great, but TypeScript can also prevent us from...
Read more >Documentation - Narrowing - TypeScript
Understand how TypeScript uses JavaScript knowledge to reduce the amount of type syntax in your projects.
Read more >Documentation - Creating Types from Types - TypeScript
TypeScript's type system is very powerful because it allows expressing types in terms of other types. The simplest form of this idea is...
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
Still an issue in 2.1.2
any update on this @xile611 ? Seems like it could be a simple fix for someone knowing the types a bit, and this is currently throwing off the build processes of many people using this otherwise awesome library.