From 05e55d266807f42460493ee0877f6af3d8cc64f9 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Thu, 17 Oct 2019 17:12:54 +0300 Subject: [PATCH] wrapInitialProps typing --- src/next-lib.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; }