diff --git a/src/next-lib.ts b/src/next-lib.ts index 626adb36..e6ee490c 100644 --- a/src/next-lib.ts +++ b/src/next-lib.ts @@ -1,4 +1,5 @@ import axios from 'axios' +import { NextPageContext } from 'next' export interface IResponseItems { items: T[] @@ -20,8 +21,8 @@ export async function requestGet(url: string, defaultResponse: T): Promise * * @param {*} fn */ -export function wrapInitialProps(fn) { - return async ctx => { +export function wrapInitialProps(fn: (ctx: NextPageContext) => void) { + return async (ctx: NextPageContext) => { if (process.env.NODE_ENV === 'production' && process.browser) { return window['__NEXT_DATA__'].props.pageProps; }