From 9e8a320a800470f1bca34e07e23457538148412e Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Sat, 23 Dec 2023 11:48:22 +0000 Subject: [PATCH] add type test --- test/typescript/store.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/typescript/store.ts b/test/typescript/store.ts index 55948e1329..834fb55686 100644 --- a/test/typescript/store.ts +++ b/test/typescript/store.ts @@ -61,6 +61,11 @@ const funcWithStore = (store: Store) => {} const store: Store = createStore(reducer) +// test that nullable state is preserved +const nullableStore = createStore((): string | null => null) + +expectTypeOf(nullableStore.getState()).toEqualTypeOf() + // ensure that an array-based state works const arrayReducer = (state: any[] = []) => state || [] const storeWithArrayState: Store = createStore(arrayReducer)