mw.test => ts

typescript
Yanick Champoux 2019-10-23 17:58:18 -04:00
parent e63f844bdc
commit 366bd91cf6
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,7 @@ test( 'simple effect', () => {
const store = updux({
effects: {
foo: api => next => action => {
foo: (api:any) => (next:any) => (action:any) => {
tracer();
next(action);
},
@ -30,7 +30,7 @@ test( 'effect and sub-effect', () => {
const tracer = jest.fn();
const tracerEffect = signature => api => next => action => {
const tracerEffect = ( signature: string ) => ( api:any ) => (next:any) => ( action: any ) => {
tracer(signature);
next(action);
};
@ -83,7 +83,7 @@ test( '"*" effect', () => {
test( 'async effect', async () => {
function timeout(ms) {
function timeout(ms:number) {
return new Promise(resolve => setTimeout(resolve, ms));
}

View File

@ -1,3 +1,4 @@
import { Middleware } from 'redux';
export type Action = {
type: string,
@ -20,7 +21,7 @@ export type UpduxConfig<S=any> = Partial<{
[ type: string ]: ActionPayloadGenerator
},
mutations: any,
effects: any,
effects: Dictionary<Middleware>,
}>;
export type Upreducer<S=any> = (action:Action) => (state:S) => S;