Просмотр исходного кода

chore(ui): Add RouterProps children for react 18 (#65759)

Scott Cooper 1 год назад
Родитель
Сommit
0b058a3f62
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      static/app/types/react-router.d.ts

+ 6 - 1
static/app/types/react-router.d.ts

@@ -1,8 +1,13 @@
-import type {ComponentClass, ComponentType, FunctionComponent} from 'react';
+import type {ComponentClass, ComponentType, FunctionComponent, ReactNode} from 'react';
 import type {InjectedRouter, PlainRoute, WithRouterProps} from 'react-router';
 import type {InjectedRouter, PlainRoute, WithRouterProps} from 'react-router';
 import type {Location} from 'history';
 import type {Location} from 'history';
 
 
 declare module 'react-router' {
 declare module 'react-router' {
+  // React 18 removed children from ComponentType, this adds them back
+  interface RouterProps {
+    children?: ReactNode;
+  }
+
   interface InjectedRouter<P = Record<string, string>, Q = any> {
   interface InjectedRouter<P = Record<string, string>, Q = any> {
     location: Location<Q>;
     location: Location<Q>;
     params: P;
     params: P;