Skip to content

Commit 9e8a320

Browse files
committed
add type test
1 parent 3e9e484 commit 9e8a320

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/typescript/store.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ const funcWithStore = (store: Store<State, DerivedAction>) => {}
6161

6262
const store: Store<State> = createStore(reducer)
6363

64+
// test that nullable state is preserved
65+
const nullableStore = createStore((): string | null => null)
66+
67+
expectTypeOf(nullableStore.getState()).toEqualTypeOf<string | null>()
68+
6469
// ensure that an array-based state works
6570
const arrayReducer = (state: any[] = []) => state || []
6671
const storeWithArrayState: Store<any[]> = createStore(arrayReducer)

0 commit comments

Comments
 (0)