Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing typing for the default component property children for react@17 #570

Open
ghost opened this issue May 11, 2022 · 1 comment
Open

Comments

@ghost
Copy link

ghost commented May 11, 2022

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch connected-react-router@6.9.2 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/connected-react-router/index.d.ts b/node_modules/connected-react-router/index.d.ts
index f2e7bcc..2786540 100644
--- a/node_modules/connected-react-router/index.d.ts
+++ b/node_modules/connected-react-router/index.d.ts
@@ -22,6 +22,7 @@ declare module 'connected-react-router' {
     noInitialPop?: boolean;
     noTimeTravelDebugging?: boolean;
     omitRouter?: boolean;
+    children?: JSX.Element;
   }
 
   export type RouterActionType = Action;

This issue body was partially generated by patch-package.

@wshamim
Copy link

wshamim commented May 23, 2022

Yeah React is complaining about missing children prop after upgrading to >=17.

TS2769: No overload matches this call. 聽聽Overload 1 of 2, '(props: ConnectedRouterProps<PoorMansUnknown> | Readonly<ConnectedRouterProps<PoorMansUnknown>>): ConnectedRouter<...>', gave the following error. 聽聽聽聽Type '{ children: Element; history: History<PoorMansUnknown>; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ConnectedRouter<PoorMansUnknown>> & Readonly<...>'. 聽聽聽聽聽聽Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ConnectedRouter<PoorMansUnknown>> & Readonly<...>'. 聽聽Overload 2 of 2, '(props: ConnectedRouterProps<PoorMansUnknown>, context: any): ConnectedRouter<PoorMansUnknown>', gave the following error. 聽聽聽聽Type '{ children: Element; history: History<PoorMansUnknown>; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ConnectedRouter<PoorMansUnknown>> & Readonly<...>'. 聽聽聽聽聽聽Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ConnectedRouter<PoorMansUnknown>> & Readonly<...>'..

@kpavlov7 thanks for the idea to fix it temporarily with patch-package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant