fix(types,testing): tighten action context typing and update tests for stricter TypeScript checks

This commit is contained in:
2026-04-30 09:58:42 +00:00
parent a66518bde8
commit a62fa83afc
9 changed files with 97 additions and 18706 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
import { expect, tap } from '@push.rocks/tapbundle';
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as smartstate from '../ts/index.js';
type TMyStateParts = 'testStatePart';
@@ -39,7 +39,7 @@ tap.test('should select something', async () => {
tap.test('should dispatch a state action', async (tools) => {
const done = tools.defer();
const addFavourite = testStatePart.createAction<string>(async (statePart, payload) => {
const currentState = statePart.getState();
const currentState = statePart.getState()!;
return {
...currentState,
currentFavorites: [...currentState.currentFavorites, payload],
@@ -51,9 +51,9 @@ tap.test('should dispatch a state action', async (tools) => {
})
.then(() => {
done.resolve();
});
});
await testStatePart.dispatchAction(addFavourite, 'my favourite things');
expect(testStatePart.getState().currentFavorites).toContain('my favourite things');
expect(testStatePart.getState()!.currentFavorites).toContain('my favourite things');
await done.promise;
});