Giter VIP home page Giter VIP logo

Type '{ children: () => Element; history: History<unknown>; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ConnectedRouter<unknown>> & Readonly<ConnectedRouterProps<unknown>>'. about connected-react-router HOT 5 OPEN

Umar-Farooq-Shafi avatar Umar-Farooq-Shafi commented on June 2, 2024 9
Type '{ children: () => Element; history: History; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly>'.

from connected-react-router.

Comments (5)

kg-currenxie avatar kg-currenxie commented on June 2, 2024 1

For now, you can use patch-package to do the change locally:

Example diff: (v6.7.0)

diff --git a/node_modules/connected-react-router/index.d.ts b/node_modules/connected-react-router/index.d.ts
index c56beb1..5d59f58 100644
--- a/node_modules/connected-react-router/index.d.ts
+++ b/node_modules/connected-react-router/index.d.ts
@@ -91,7 +91,7 @@ declare module 'connected-react-router' {
   }
 
   export class ConnectedRouter<S = LocationState> extends React.Component<
-    ConnectedRouterProps<S>,
+    React.PropsWithChildren<ConnectedRouterProps<S>>,
     {}
   > {}
 

The TSC error went away for me :)

from connected-react-router.

Kalsyc avatar Kalsyc commented on June 2, 2024

Facing same problem

from connected-react-router.

athomann avatar athomann commented on June 2, 2024

I believe this is because of React 18 changing typing for children

from connected-react-router.

devflovvv avatar devflovvv commented on June 2, 2024

same issue, anyone found out whats going on ?

from connected-react-router.

foscjos2 avatar foscjos2 commented on June 2, 2024

@tanzeelrana as mentioned above, react 18 changed the typing for children. AFAIK the children prop used to be included by default, now its not. You need to either add it manually to your props interface (something like "children?: React.ReactNode | undefined;") OR wrap your props in React.PropsWithChildren (React.PropsWithChildren).

What that likely means in the scope of this library, is that until the maintainer updates the props for his interfaces to include the children prop, this library is incompatible with react 18.

from connected-react-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.