Skip to content

Commit

Permalink
Modify custom type to imported type from next (#294)
Browse files Browse the repository at this point in the history
* [Types] Add resolvedUrl to GetServerSidePropsContext
- Fixed bug with incompatible next v9.5.5
* Modify custom type to imported type from next
  • Loading branch information
qvil committed Oct 29, 2020
1 parent 910e6c7 commit 2adbb69
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions packages/wrapper/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import App, {AppContext, AppInitialProps} from 'next/app';
import React, {useCallback, useEffect, useRef} from 'react';
import {Store, AnyAction, Action} from 'redux';
import {Provider} from 'react-redux';
import {GetServerSideProps, GetStaticProps, NextComponentType, NextPage, NextPageContext} from 'next';
import App, {AppContext, AppInitialProps} from 'next/app';
import {IncomingMessage, ServerResponse} from 'http';
import {ParsedUrlQuery} from 'querystring';
import {Store, AnyAction, Action} from 'redux';
import {
GetServerSideProps,
GetServerSidePropsContext,
GetStaticProps,
GetStaticPropsContext,
NextComponentType,
NextPage,
NextPageContext,
} from 'next';

export const HYDRATE = '__NEXT_REDUX_WRAPPER_HYDRATE__';
export const STOREKEY = '__NEXT_REDUX_WRAPPER_STORE__';
Expand Down Expand Up @@ -59,22 +65,21 @@ const initStore = <S extends {} = any, A extends Action = AnyAction>({
};

//FIXME Use Parameters<GetServerSideProps>, see https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterst
export interface GetServerSidePropsContext {
req: IncomingMessage;
res: ServerResponse;
params?: ParsedUrlQuery;
query: ParsedUrlQuery;
preview?: boolean;
previewData?: any;
resolvedUrl: string;
}
// export interface GetServerSidePropsContext {
// req: IncomingMessage;
// res: ServerResponse;
// params?: ParsedUrlQuery;
// query: ParsedUrlQuery;
// preview?: boolean;
// previewData?: any;
// }

//FIXME Use Parameters<GetStaticProps>, see https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterst
export interface GetStaticPropsContext {
params?: ParsedUrlQuery;
preview?: boolean;
previewData?: any;
}
// export interface GetStaticPropsContext {
// params?: ParsedUrlQuery;
// preview?: boolean;
// previewData?: any;
// }

export const createWrapper = <S extends {} = any, A extends Action = AnyAction>(
makeStore: MakeStore<S, A>,
Expand Down

0 comments on commit 2adbb69

Please sign in to comment.