Skip to content

Commit

Permalink
add type test
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed Dec 23, 2023
1 parent 3e9e484 commit 9e8a320
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/typescript/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ const funcWithStore = (store: Store<State, DerivedAction>) => {}

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

// test that nullable state is preserved
const nullableStore = createStore((): string | null => null)

expectTypeOf(nullableStore.getState()).toEqualTypeOf<string | null>()

// ensure that an array-based state works
const arrayReducer = (state: any[] = []) => state || []
const storeWithArrayState: Store<any[]> = createStore(arrayReducer)
Expand Down

0 comments on commit 9e8a320

Please sign in to comment.