fix(core): update

This commit is contained in:
Philipp Kunz 2019-02-27 02:00:47 +01:00
parent a4d43456d7
commit c5a3eb63ad
4 changed files with 8 additions and 6 deletions

View File

@ -24,4 +24,4 @@
"@pushrocks/lik": "^3.0.4",
"rxjs": "^6.4.0"
}
}
}

View File

@ -39,11 +39,11 @@ tap.test('should select something', async () => {
tap.test('should dispatch a state action', async () => {
const addFavourite = testStatePart.createAction<string>(async (statePart, payload) => {
const currentState = statePart.getState();
currentState.currentFavorites.push(payload)
currentState.currentFavorites.push(payload);
return currentState;
});
await testStatePart.dispatchAction(addFavourite, 'my favourite things')
expect(testStatePart.getState().currentFavorites).to.include('my favourite things')
await testStatePart.dispatchAction(addFavourite, 'my favourite things');
expect(testStatePart.getState().currentFavorites).to.include('my favourite things');
});
tap.start();

View File

@ -2,7 +2,7 @@ import * as plugins from './smartstate.plugins';
import { StatePart } from './smartstate.classes.statepart';
export interface IActionDef<TStateType, TActionPayloadType> {
(stateArg: StatePart<any, TStateType>, actionPayload: TActionPayloadType): Promise<TStateType>;
(stateArg: StatePart<any, TStateType>, actionPayload: TActionPayloadType): Promise<TStateType>;
}
/**

View File

@ -56,7 +56,9 @@ export class StatePart<TStatePartName, TStatePayload> {
/**
* creates an action capable of modifying the state
*/
createAction <TActionPayload>(actionDef: IActionDef<TStatePayload, TActionPayload>): StateAction<TStatePayload, TActionPayload> {
createAction<TActionPayload>(
actionDef: IActionDef<TStatePayload, TActionPayload>
): StateAction<TStatePayload, TActionPayload> {
return new StateAction(actionDef);
}