File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
- import App , { AppContext , AppInitialProps } from 'next/app' ;
1
+ import App , { AppContext , AppInitialProps , AppProps } from 'next/app' ;
2
2
import React , { useEffect , useMemo , useRef } from 'react' ;
3
3
import { Provider } from 'react-redux' ;
4
4
import { Store } from 'redux' ;
@@ -211,10 +211,10 @@ export const createWrapper = <S extends Store>(makeStore: MakeStore<S>, config:
211
211
} ;
212
212
213
213
// giapState stands for getInitialAppProps state
214
- const useWrappedStore = (
215
- { initialState : giapState , initialProps , ... props } : any ,
216
- displayName = 'useWrappedStore' ,
217
- ) : { store : S ; props : any } => {
214
+ const useWrappedStore = < P extends AppProps > ( incomingProps : P , displayName = 'useWrappedStore' ) : { store : S ; props : P } => {
215
+ // createWrapper adds WrapperProps to incomingProps, they are not present in P so type needs to be coerced here
216
+ const { initialState : giapState , initialProps , ... props } = incomingProps as P & WrapperProps ;
217
+
218
218
// getStaticProps state
219
219
const gspState = props ?. __N_SSG ? props ?. pageProps ?. initialState : null ;
220
220
// getServerSideProps state
You can’t perform that action at this time.
0 commit comments