fix(types): adding correct redirect-home props to fix some ts-ignores (#50810)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Mateo Guzmán
2023-06-29 19:33:07 +03:00
committed by GitHub
co-authored by Oliver Eyton-Williams
parent 8d12376931
commit ebc9343e8f
5 changed files with 10 additions and 14 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
/* eslint-disable react/display-name */
import { navigate } from 'gatsby';
import type { RouteComponentProps } from '@reach/router';
const createRedirect =
(to = '/'): (() => JSX.Element | null) =>
(to = '/'): ((_props: RouteComponentProps) => JSX.Element | null) =>
() => {
if (typeof window !== 'undefined') {
void navigate(to);
+2 -3
View File
@@ -16,9 +16,8 @@ function Certification(): JSX.Element {
// @ts-ignore
path={withPrefix('/certification/:username/:certSlug')}
/>
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
<RedirectHome default={true} />
<RedirectHome default />
</Router>
);
}
+2 -3
View File
@@ -9,9 +9,8 @@ function Settings(): JSX.Element {
return (
<Router>
<ShowSettings path={withPrefix('/settings')} />
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
<RedirectHome default={true} />
<RedirectHome default />
</Router>
);
}
+2 -3
View File
@@ -14,9 +14,8 @@ function Unsubscribed(): JSX.Element {
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
<ShowUnsubscribed path={withPrefix('/unsubscribed')} />
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
<RedirectHome default={true} />
<RedirectHome default />
</Router>
);
}
+2 -3
View File
@@ -10,9 +10,8 @@ function User(): JSX.Element {
<Router>
{/* @ts-expect-error Adding path property breaks username typing */}
<ShowUser path={withPrefix('/user/:username/report-user')} />
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
<RedirectHome default={true} />
<RedirectHome default />
</Router>
);
}