mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 06:17:04 +00:00
pass the test
This commit is contained in:
+10
-8
@@ -1,5 +1,7 @@
|
||||
// <reference path="../react/react.d.ts" />
|
||||
// <reference path="./dva.d.ts" />
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="./dva.d.ts" />
|
||||
|
||||
import React = __React;
|
||||
|
||||
import dva from 'dva';
|
||||
import { connect } from 'dva';
|
||||
@@ -13,10 +15,10 @@ app.model({
|
||||
namespace: 'count',
|
||||
state: 0,
|
||||
reducers: {
|
||||
add (count) {
|
||||
add(count: number) {
|
||||
return count + 1
|
||||
},
|
||||
minus(count) {
|
||||
minus(count: number) {
|
||||
return count - 1
|
||||
},
|
||||
},
|
||||
@@ -25,12 +27,12 @@ app.model({
|
||||
// 3. View
|
||||
const App = connect(({ count }) => ({
|
||||
count
|
||||
}))(function (props) {
|
||||
}))(function ({ count, dispatch }) {
|
||||
return (
|
||||
<div>
|
||||
<h2>{ props.count }</h2>
|
||||
<button key="add" onClick={() => { props.dispatch({type: 'count/add'})}}>+</button>
|
||||
<button key="minus" onClick={() => { props.dispatch({type: 'count/minus'})}}>-</button>
|
||||
<h2>{ count }</h2>
|
||||
<button key="add" onClick={() => { dispatch({type: 'count/add'})}}>+</button>
|
||||
<button key="minus" onClick={() => { dispatch({type: 'count/minus'})}}>-</button>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
Vendored
+21
-4
@@ -1,10 +1,12 @@
|
||||
// Type definitions for dva v1.0.0
|
||||
// Project: https://github.com/dvajs/dva
|
||||
// Definitions by: nikogu <https://github.com/nikogu/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
declare module 'dva' {
|
||||
/** connecting Container Components */
|
||||
export function connect(maps):Function;
|
||||
export function connect(maps:Object):Function;
|
||||
|
||||
export default function dva(opts?:Object):{
|
||||
|
||||
@@ -18,7 +20,7 @@ declare module 'dva' {
|
||||
model: (model:Object)=>void,
|
||||
|
||||
/** dva setting router */
|
||||
router: (router)=>void,
|
||||
router: (router:Object)=>void,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,8 +28,23 @@ declare module 'dva' {
|
||||
* https://github.com/reactjs/react-router
|
||||
*/
|
||||
declare module 'dva/router' {
|
||||
export class Router {}
|
||||
export class Route {}
|
||||
import React = __React;
|
||||
|
||||
interface RouterProps {
|
||||
history?: Object
|
||||
}
|
||||
export class Router extends React.Component<RouterProps, {}> {
|
||||
render(): JSX.Element
|
||||
}
|
||||
|
||||
|
||||
interface RouteProps {
|
||||
path?: string,
|
||||
component?: React.ReactNode
|
||||
}
|
||||
export class Route extends React.Component<RouteProps, {}> {
|
||||
render(): JSX.Element
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user