Merge pull request #26797 from Jimexist/add-wepy-redux

add wepy-redux typings
This commit is contained in:
Paul van Brenk
2018-06-26 11:05:46 -07:00
committed by GitHub
4 changed files with 70 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for wepy-redux 1.7
// 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
import wepy from "wepy";
export interface MapStateToProps {
[propName: string]: ((state: any) => any) | string;
}
export interface MapDispatchToProps {
[propName: string]: ((store: any, ...args: any[]) => void) | string;
}
export function connect(
mapStateToProps: MapStateToProps,
mapDispatchToProps: MapDispatchToProps
): (<T extends wepy.Component>(original: T) => T);
export function setStore(store: any): void;
+17
View File
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "wepy-redux-tests.ts"]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+29
View File
@@ -0,0 +1,29 @@
import wepy from "wepy";
import { connect } from "wepy-redux";
interface State {
counter: {
num: number;
};
}
@connect(
{
num(state: State) {
return state.counter.num;
},
inc: "inc"
},
{
addNum: "INCREMENT",
asyncInc: () => {}
}
)
export default class Index extends wepy.page {
// methods
methods = {
// method values
};
// on load
onLoad() {}
}