mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
add wepy-redux
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
|
||||
): (original: wepy.component) => wepy.component;
|
||||
|
||||
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 = {
|
||||
// ...
|
||||
};
|
||||
// ...
|
||||
onLoad() {}
|
||||
}
|
||||
Vendored
+13
-5
@@ -13,12 +13,20 @@ import util from "./util";
|
||||
import base from "./base";
|
||||
import { WxEnhances } from "./wx_enhanced";
|
||||
|
||||
export as namespace wepy;
|
||||
|
||||
export type event = typeof event;
|
||||
export type component = typeof component;
|
||||
export type app = typeof app;
|
||||
export type page = typeof page;
|
||||
export type mixin = typeof mixin;
|
||||
|
||||
interface DefaultExport extends WxEnhances {
|
||||
event: typeof event;
|
||||
app: typeof app;
|
||||
component: typeof component;
|
||||
page: typeof page;
|
||||
mixin: typeof mixin;
|
||||
event: wepy.event;
|
||||
app: wepy.app;
|
||||
component: wepy.component;
|
||||
page: wepy.page;
|
||||
mixin: wepy.mixin;
|
||||
$createApp: typeof base.$createApp;
|
||||
$createPage: typeof base.$createPage;
|
||||
$isEmpty: typeof util.$isEmpty;
|
||||
|
||||
Reference in New Issue
Block a user