We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 42ac8ee commit 63d1e81Copy full SHA for 63d1e81
tests/vanilla/basic.test.ts
@@ -112,6 +112,24 @@ it('can set the store without merging', () => {
112
expect(getState()).toEqual({ b: 2 })
113
})
114
115
+it('can set the object store to null', () => {
116
+ const { setState, getState } = createStore<{ a: number } | null>(() => ({
117
+ a: 1,
118
+ }))
119
+
120
+ setState(null)
121
122
+ expect(getState()).toEqual(null)
123
+})
124
125
+it('can set the non-object store to null', () => {
126
+ const { setState, getState } = createStore<string | null>(() => 'value')
127
128
129
130
131
132
133
it('works with non-object state', () => {
134
const store = createStore<number>(() => 1)
135
const inc = () => store.setState((c) => c + 1)
0 commit comments