DefinitelyTyped/types/next-redux-wrapper/index.d.ts
Andrew Casey 72b4da337a
Merge pull request #30760 from surgeboris/react-redux
[react-redux] fixed mistreating of action thunk creator parameters
2018-12-07 15:14:54 -08:00

51 lines
1.9 KiB
TypeScript

// Type definitions for next-redux-wrapper 2.0
// Project: https://github.com/kirill-konshin/next-redux-wrapper
// Definitions by: Steve <https://github.com/stevegeek>
// Jungwoo-An <https://github.com/Jungwoo-An>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from 'http';
import { ComponentType } from 'react';
import {
MapDispatchToPropsParam, MapStateToPropsParam,
MergeProps, Options as ConnectOptions
} from 'react-redux';
import { Store } from 'redux';
declare namespace nextReduxWrapper {
interface Options {
storeKey?: string;
debug?: boolean;
serializeState?: any;
deserializeState?: any;
}
interface StoreCreatorOptions<TInitialState, TStateProps, TDispatchProps, TOwnProps, TMergedProps> extends Options {
isServer: boolean;
req?: IncomingMessage;
res?: ServerResponse;
query?: any;
}
interface NextPageComponentMethods {
getInitialProps(props: any): Promise<any>;
}
type NextReduxWrappedComponent<P> = ComponentType<P> & NextPageComponentMethods;
type NextStoreCreator<TInitialState, TStateProps, TDispatchProps, TOwnProps, TMergedProps> = (
initialState: TInitialState,
options: StoreCreatorOptions<TInitialState, TStateProps, TDispatchProps, TOwnProps, TMergedProps>
) => Store<TInitialState>;
}
declare function nextReduxWrapper<TInitialState = any, TStateProps = any, TDispatchProps = any, TOwnProps = any, TMergedProps = any>(
makeStore: nextReduxWrapper.NextStoreCreator<TInitialState, TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
config?: nextReduxWrapper.Options
): (ComponentType: ComponentType<TOwnProps & TMergedProps>) => nextReduxWrapper.NextReduxWrappedComponent<TOwnProps>;
export default nextReduxWrapper;