Skip to content

Commit 2b10811

Browse files
br1anchenSaraVieira
authored andcommitted
Chore: Add react-router-dom typing (#2869)
* Add @types/react-router-dom to app repo * fix known typing errors for missing RouteComponentProps for withRouter component
1 parent 263774c commit 2b10811

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
"@types/react-dom": "^16.8.3",
240240
"@types/react-helmet": "^5.0.11",
241241
"@types/react-icons": "2.2.7",
242+
"@types/react-router-dom": "^4.3.1",
242243
"@types/react-stripe-elements": "^1.3.2",
243244
"@types/resolve": "^0.0.8",
244245
"@types/socket.io-client": "^1.4.32",

packages/app/src/app/pages/Dashboard/Sidebar/TemplateItem/TemplateItem.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { DropTarget } from 'react-dnd';
3-
import { withRouter } from 'react-router-dom';
3+
import { withRouter, RouteComponentProps } from 'react-router-dom';
44
// @ts-ignore
55
import TemplateIcon from '-!svg-react-loader!@codesandbox/common/lib/icons/template.svg';
66
import { Item } from '../Item';
@@ -14,13 +14,9 @@ interface ITemplateItemProps {
1414
connectDropTarget?: any;
1515
}
1616

17-
const TemplateItemComponent: React.FC<ITemplateItemProps> = ({
18-
currentPath,
19-
isOver,
20-
canDrop,
21-
connectDropTarget,
22-
teamId,
23-
}: ITemplateItemProps) => {
17+
const TemplateItemComponent: React.FC<
18+
ITemplateItemProps & RouteComponentProps
19+
> = ({ currentPath, isOver, canDrop, connectDropTarget, teamId }) => {
2420
const url = teamId
2521
? `/dashboard/teams/${teamId}/templates`
2622
: `/dashboard/templates`;

packages/app/src/app/pages/common/ErrorBoundary/ErrorBoundary.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { Component } from 'react';
2+
import { RouteComponentProps } from 'react-router-dom';
23
import { CodeSadbox } from './CodeSadbox';
34
import { IErrorBoundaryProps, ErrorInfo, IErrorBoundaryState } from './types';
45

56
export class ErrorBoundary extends Component<
6-
IErrorBoundaryProps,
7+
RouteComponentProps & IErrorBoundaryProps,
78
IErrorBoundaryState
89
> {
910
static getDerivedStateFromError(error: Error) {

yarn.lock

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4127,6 +4127,23 @@
41274127
"@types/prop-types" "*"
41284128
"@types/react" "*"
41294129

4130+
"@types/react-router-dom@^4.3.1":
4131+
version "4.3.5"
4132+
resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-4.3.5.tgz#72f229967690c890d00f96e6b85e9ee5780db31f"
4133+
integrity sha512-eFajSUASYbPHg2BDM1G8Btx+YqGgvROPIg6sBhl3O4kbDdYXdFdfrgQFf/pcBuQVObjfT9AL/dd15jilR5DIEA==
4134+
dependencies:
4135+
"@types/history" "*"
4136+
"@types/react" "*"
4137+
"@types/react-router" "*"
4138+
4139+
"@types/react-router@*":
4140+
version "5.1.2"
4141+
resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-5.1.2.tgz#41e5e6aa333a7b9a2bfdac753c04e1ca4b3e0d21"
4142+
integrity sha512-euC3SiwDg3NcjFdNmFL8uVuAFTpZJm0WMFUw+4eXMUnxa7M9RGFEG0szt0z+/Zgk4G2k9JBFhaEnY64RBiFmuw==
4143+
dependencies:
4144+
"@types/history" "*"
4145+
"@types/react" "*"
4146+
41304147
"@types/react-stripe-elements@^1.3.2":
41314148
version "1.3.2"
41324149
resolved "https://registry.yarnpkg.com/@types/react-stripe-elements/-/react-stripe-elements-1.3.2.tgz#02ed6802b16366b4ebc6b85b8bd3e8befa553b79"
@@ -8069,7 +8086,7 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0:
80698086
integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=
80708087

80718088
console-feed@CompuIves/console-feed#build2, console-feed@^2.8.5:
8072-
version "2.8.8"
8089+
version "2.8.9"
80738090
resolved "https://codeload.github.com/CompuIves/console-feed/tar.gz/42f10eb3063f0f26ee9745c4c9e4542cb5591f46"
80748091
dependencies:
80758092
emotion "^9.1.1"

0 commit comments

Comments
 (0)