Update redux type of combineReducers (#41429)

* Update redux-first-router:redux type of combineReducers

It now returns CombinedState<State> instead of just State.

* Also fix @tinajs/tina-redux

* remove unused import in tests
This commit is contained in:
Nathan Shively-Sanders
2020-01-06 11:20:25 -08:00
committed by GitHub
parent 32f58bbeea
commit b837d4636a
3 changed files with 6 additions and 6 deletions
@@ -127,7 +127,7 @@ const action: ReduxFirstRouterAction = {
};
redirect(action); // $ExpectType Action
// $ExpectType Store<State, AnyAction>
// $ExpectType Store<CombinedState<State>, AnyAction>
store;
store.getState().location.routesMap; // $ExpectType RoutesMap<Keys, State>
+3 -3
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tinajs__tina-redux
// TypeScript Version: 2.8
import { Store, Dispatch } from "redux";
import { Store, Dispatch, Action } from "redux";
type MapStateToProps = (state: any) => any;
type mapDispatchToProps = (dispatch: Dispatch) => any;
@@ -15,8 +15,8 @@ interface HOC {
methods: object;
}
declare class TinaRedux {
constructor(reduxStore: Store);
declare class TinaRedux<S, A extends Action> {
constructor(reduxStore: Store<S, A>);
connect(mapState?: MapStateToProps, mapDispatch?: mapDispatchToProps): HOC;
}
@@ -9,14 +9,14 @@ interface Todo {
interface TodoAction extends Action, Todo {}
const intialState: Todo[] = [
const initialState: Todo[] = [
{ id: 1, text: "Star Tina.js", completed: false },
{ id: 2, text: "Star Tina-Redux", completed: true },
{ id: 3, text: "Build a mini-program with Tina.js", completed: false },
{ id: 4, text: "Add to Showcase of Tina.js", completed: false }
];
const todos = (state = intialState, action: TodoAction) => {
const todos = (state = initialState, action: TodoAction) => {
switch (action.type) {
case "ADD_TODO":
return [