From 08c7b3d0eb2ced622cdd3c4d14a3958ac8161cb8 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 21 Sep 2022 12:20:18 +0200 Subject: fix(types): add custom types to pageProps with translation --- src/ts/types/app.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/ts') diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts index c11c31b..64bb3af 100644 --- a/src/ts/types/app.ts +++ b/src/ts/types/app.ts @@ -1,6 +1,7 @@ import { NextPage } from 'next'; -import { AppProps } from 'next/app'; +import { AppProps as NextAppProps } from 'next/app'; import { ReactElement, ReactNode } from 'react'; +import { MessageFormatElement } from 'react-intl'; export type NextPageWithLayoutOptions = { withExtraPadding?: boolean; @@ -15,7 +16,16 @@ export type NextPageWithLayout = NextPage & { ) => ReactNode; }; -export type AppPropsWithLayout = AppProps & { +// modified version - allows for custom pageProps type, falling back to 'any' +type AppProps

= { + pageProps: P; +} & Omit, 'pageProps'>; + +type CustomPageProps = { + translation: Record | Record; +}; + +export type AppPropsWithLayout = AppProps & { Component: NextPageWithLayout; }; -- cgit v1.2.3