mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #26868 from Jimexist/add-wepy-redux
update wepy-redux typing to add getStore / setStore
This commit is contained in:
Vendored
+5
-2
@@ -2,9 +2,10 @@
|
||||
// Project: https://github.com/Tencent/wepy/tree/1.7.x/packages/wepy-redux
|
||||
// Definitions by: Jiayu Liu <https://github.com/Jimexist>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import wepy from "wepy";
|
||||
import { Store } from "redux";
|
||||
|
||||
export interface MapStateToProps {
|
||||
[propName: string]: ((state: any) => any) | string;
|
||||
@@ -18,4 +19,6 @@ export function connect(
|
||||
mapDispatchToProps: MapDispatchToProps
|
||||
): (<T extends wepy.Component>(original: T) => T);
|
||||
|
||||
export function setStore(store: any): void;
|
||||
export function setStore(store: Store): void;
|
||||
|
||||
export function getStore(): Store;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"redux": "^4.0.0"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,17 @@
|
||||
import wepy from "wepy";
|
||||
import { connect } from "wepy-redux";
|
||||
import { createStore } from "redux";
|
||||
import { connect, getStore, setStore } from "wepy-redux";
|
||||
|
||||
const store = createStore(
|
||||
(counter: number | undefined, action: { type: string; payload: number }) =>
|
||||
counter || 0 + action.payload,
|
||||
0
|
||||
);
|
||||
|
||||
setStore(store);
|
||||
|
||||
const s = getStore();
|
||||
s.dispatch({ type: "a" });
|
||||
|
||||
interface State {
|
||||
counter: {
|
||||
|
||||
Reference in New Issue
Block a user