question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

Edit on CodeSandbox

Steps to reproduce

  1. Use the link above. Do not mind the Codesandbox errors, but instead just use its Export to ZIP and download the source.
  2. Run npm install
  3. 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:open
  • Created 2 years ago
  • Reactions:33
  • Comments:9

github_iconTop GitHub Comments

7reactions
DoReVocommented, Sep 15, 2021

Still an issue in 2.1.2

7reactions
flyoncommented, Jun 8, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found