mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge pull request #26797 from Jimexist/add-wepy-redux
add wepy-redux typings
This commit is contained in:
Vendored
+21
@@ -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;
|
||||
@@ -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"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -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() {}
|
||||
}
|
||||
Reference in New Issue
Block a user