diff --git a/notNeededPackages.json b/notNeededPackages.json index 0cce8e1c66..052e6246b5 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -2856,6 +2856,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/new-github-release-url", "asOfVersion": "1.0.0" }, + { + "libraryName": "next-redux-wrapper", + "typingsPackageName": "next-redux-wrapper", + "sourceRepoURL": "https://github.com/kirill-konshin/next-redux-wrapper", + "asOfVersion": "3.0.0" + }, { "libraryName": "next", "typingsPackageName": "next", diff --git a/types/next-redux-saga/next-redux-saga-tests.tsx b/types/next-redux-saga/next-redux-saga-tests.tsx index c905971457..01453a876d 100644 --- a/types/next-redux-saga/next-redux-saga-tests.tsx +++ b/types/next-redux-saga/next-redux-saga-tests.tsx @@ -3,6 +3,10 @@ import withRedux from 'next-redux-wrapper'; import withReduxSaga from 'next-redux-saga'; import { createStore, Reducer, Store, AnyAction } from 'redux'; +// `next-redux-saga` depends on `next-redux-wrapper`, which depends on `react-redux`, CI cannot detect the `react-redux` and install it. +// Adding an explicit `react-redux` fix the issue. +import * as ReactRedux from 'react-redux'; + interface InitialState { foo: string; } diff --git a/types/next-redux-saga/package.json b/types/next-redux-saga/package.json index 6d68bf2f9b..e49bc4fc66 100644 --- a/types/next-redux-saga/package.json +++ b/types/next-redux-saga/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { + "@types/next-redux-wrapper": "^2.0.2", "redux": "^3.6.0" } } diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts deleted file mode 100644 index 10fa2d44d1..0000000000 --- a/types/next-redux-wrapper/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Type definitions for next-redux-wrapper 2.0 -// Project: https://github.com/kirill-konshin/next-redux-wrapper -// Definitions by: Steve -// Jungwoo-An -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 - -/// - -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 extends Options { - isServer: boolean; - req?: IncomingMessage; - res?: ServerResponse; - query?: any; - } - - interface NextPageComponentMethods { - getInitialProps(props: any): Promise; - } - - type NextReduxWrappedComponent

= ComponentType

& NextPageComponentMethods; - - type NextStoreCreator = ( - initialState: TInitialState, - options: StoreCreatorOptions - ) => Store; -} - -declare function nextReduxWrapper( - makeStore: nextReduxWrapper.NextStoreCreator, - config?: nextReduxWrapper.Options -): (ComponentType: ComponentType) => nextReduxWrapper.NextReduxWrappedComponent; - -export default nextReduxWrapper; diff --git a/types/next-redux-wrapper/next-redux-wrapper-tests.tsx b/types/next-redux-wrapper/next-redux-wrapper-tests.tsx deleted file mode 100644 index 2d338ec220..0000000000 --- a/types/next-redux-wrapper/next-redux-wrapper-tests.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import * as React from 'react'; -import withRedux from 'next-redux-wrapper'; -import { createStore, Reducer, Store, AnyAction } from 'redux'; - -interface InitialState { - foo: string; -} - -const reducer: Reducer = (state: InitialState = { foo: '' }, action: AnyAction): InitialState => { - switch (action.type) { - case 'FOO': - return { ...state, foo: action.payload }; - default: - return state; - } -}; - -const makeStore = (initialState: InitialState): Store => { - return createStore(reducer, initialState); -}; - -interface OwnProps { - bar: string; -} - -interface Props { - foo: string; - custom: string; -} - -class Page extends React.Component { - static getInitialProps({ store, isServer, pathname, query }: any) { - store.dispatch({ type: 'FOO', payload: 'foo' }); - return { custom: 'custom' }; - } - render() { - return ( -

-
Prop from Redux {this.props.foo}
-
Prop from getInitialProps {this.props.custom}
-
- ); - } -} - -type ConnectStateProps = Props; -type DispatchProps = Props; -type MergedProps = Props; - -// Test various typings - -const Com1 = withRedux( - (initialState: InitialState, options) => { - if (options.isServer || options.req || options.query || options.res) { - const a = 1; - } - return createStore(reducer, initialState); - }, -)(Page); - -const Com2 = withRedux(makeStore)(Page); - -const com1Instance = (); -const com2Instance = (); diff --git a/types/next-redux-wrapper/package.json b/types/next-redux-wrapper/package.json deleted file mode 100644 index 6d68bf2f9b..0000000000 --- a/types/next-redux-wrapper/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "redux": "^3.6.0" - } -} diff --git a/types/next-redux-wrapper/tsconfig.json b/types/next-redux-wrapper/tsconfig.json deleted file mode 100644 index 7cfafdcb96..0000000000 --- a/types/next-redux-wrapper/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "jsx": "react", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "next-redux-wrapper-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/next-redux-wrapper/tslint.json b/types/next-redux-wrapper/tslint.json deleted file mode 100644 index 71ee04c4e1..0000000000 --- a/types/next-redux-wrapper/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-unnecessary-generics": false - } -}