Skip to content

Compilation error in Sankey.d.ts in v2.6.0 & v2.6.1 #3580

Description

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

Reproduction link

https://github.com/mtlewis/recharts-ts-repro

Steps to reproduce

  1. Clone repro
  2. yarn
  3. yarn tsc - note the compilation error

What is expected?

This project should compile without issues, since it's simply re-exporting recharts. This seems to me to be the most minimal way of reproducing the issue, which was first encountered in a larger project that uses recharts.

What is actually happening?

The following compilation error occurs:

node_modules/recharts/types/chart/Sankey.d.ts:81:53 - error TS2344: Type 'Props<ValueType, string | number> & { allowEscapeViewBox?: { x?: boolean; y?: boolean; }; reverseDirection?: { x?: boolean; y?: boolean; }; content?: ContentType<ValueType, string | number>; ... 14 more ...; useTranslate3d?: boolean; } & { ...; }' does not satisfy the constraint 'HTMLAttributes<HTMLElement>'.
  Types of property 'content' are incompatible.
    Type 'ContentType<ValueType, string | number>' is not assignable to type 'string'.
      Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'string'.

 81     renderTooltip(): React.DetailedReactHTMLElement<import("../component/DefaultTooltipContent").Props<import("../component/DefaultTooltipContent").ValueType, string | number> & {
                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 82         allowEscapeViewBox?: {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
118         children?: React.ReactNode;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119     }, HTMLElement>;
    ~~~~~


Found 1 error in node_modules/recharts/types/chart/Sankey.d.ts:81

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Environment Info
Recharts v2.6.0
React 18.2.0
System macOS
Browser N/A

I see that 2.6.1 was just released - this issue occurs in both 2.6.0 and 2.6.1 (but not 2.5.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Critical priority issuesbugGeneral bug label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions