Skip to content

Version 5.1.5 - multiple versions of @types/react causes typescript build errors #1320

@captain-igloo

Description

@captain-igloo

From version 5.1.5 I get errors building my typescript project due to multiple versions of @types/react. I'm not sure if this is a problem with html-react-parser or with @types/react.

See 78b7a8e

Expected Behavior

Should build correctly, possibly should have dependency on @types/react version ^18.2.55 instead of 18.2.55

Actual Behavior

node_modules/@types/react/index.d.ts:4127:14 - error TS2300: Duplicate identifier 'ElementType'.

4127         type ElementType = string | React.JSXElementConstructor<any>;
                  ~~~~~~~~~~~

  node_modules/html-react-parser/node_modules/@types/react/index.d.ts:4127:14
    4127         type ElementType = string | React.JSXElementConstructor<any>;
                      ~~~~~~~~~~~
    'ElementType' was also declared here.

node_modules/@types/react/index.d.ts:4141:14 - error TS2300: Duplicate identifier 'LibraryManagedAttributes'.

4141         type LibraryManagedAttributes<C, P> = C extends
                  ~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/html-react-parser/node_modules/@types/react/index.d.ts:4141:14
    4141         type LibraryManagedAttributes<C, P> = C extends
                      ~~~~~~~~~~~~~~~~~~~~~~~~
    'LibraryManagedAttributes' was also declared here.

node_modules/html-react-parser/node_modules/@types/react/index.d.ts:4127:14 - error TS2300: Duplicate identifier 'ElementType'.

4127         type ElementType = string | React.JSXElementConstructor<any>;
                  ~~~~~~~~~~~

  node_modules/@types/react/index.d.ts:4127:14
    4127         type ElementType = string | React.JSXElementConstructor<any>;
                      ~~~~~~~~~~~
    'ElementType' was also declared here.

node_modules/html-react-parser/node_modules/@types/react/index.d.ts:4141:14 - error TS2300: Duplicate identifier 'LibraryManagedAttributes'.

4141         type LibraryManagedAttributes<C, P> = C extends
                  ~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@types/react/index.d.ts:4141:14
    4141         type LibraryManagedAttributes<C, P> = C extends
                      ~~~~~~~~~~~~~~~~~~~~~~~~
    'LibraryManagedAttributes' was also declared here.

Steps to Reproduce

git clone [email protected]:captain-igloo/html-react-parser-bug.git
cd html-react-parser-bug
npm ci
npm run build

Reproducible Demo

https://github.com/captain-igloo/html-react-parser-bug

Keywords

@types/react

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions