fix(types): four-oh-four props, global i18next definition for returnNull (#50809)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
Mateo Guzmán
2023-06-29 09:16:17 +02:00
committed by GitHub
parent c71243bcee
commit a314242727
5 changed files with 16 additions and 6 deletions
+2 -1
View File
@@ -12,7 +12,8 @@ i18n
},
lng: 'en',
ns: ['translations'],
resources: { en: { translations: {} } }
resources: { en: { translations: {} } },
returnNull: false
})
.catch((error: Error) => {
throw Error(error.message);
+2 -1
View File
@@ -73,7 +73,8 @@ i18n.use(initReactI18next).init({
},
react: {
useSuspense: true
}
},
returnNull: false
});
i18n.languages = clientLocale;
+2 -1
View File
@@ -1,3 +1,4 @@
import { RouteComponentProps } from '@reach/router';
import { Link } from 'gatsby';
import React from 'react';
import Helmet from 'react-helmet';
@@ -9,7 +10,7 @@ import { Spacer } from '../helpers';
import './404.css';
const FourOhFour = (): JSX.Element => {
const FourOhFour = (_props: RouteComponentProps): JSX.Element => {
const { t } = useTranslation();
const quote = randomQuote();
return (
+8
View File
@@ -0,0 +1,8 @@
import 'i18next';
// This should not be necessary when upgrading to v23.0.0
declare module 'i18next' {
interface CustomTypeOptions {
returnNull: false;
}
}
+2 -3
View File
@@ -14,9 +14,8 @@ function FourOhFourPage(): JSX.Element {
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
<ShowProfileOrFourOhFour path={withPrefix('/:maybeUser')} />
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
<FourOhFour default={true} />
<FourOhFour default />
</Router>
);
}