-// in this file we could import other stores that use one each other
-// while avoiding any recursive import
+// in this file we could import other stores that use one each other while
+// avoiding any recursive import
import { createStore } from '../../src'
import { expectType, expectError } from 'tsd'
-const store = createStore(
- 'name',
- () => ({ a: 'on' as 'on' | 'off' }),
- {
- upper: state => state.a.toUpperCase(),
- },
- {
- doStuff(store, n: number, a: 'on' | 'off') {},
- }
-)
+const store = createStore('name', () => ({ a: 'on' as 'on' | 'off' }), {
+ upper: state => state.a.toUpperCase(),
+})
expectType<{ a: 'on' | 'off' }>(store.state)
Id extends string,
S extends StateTree,
G extends Record<string, StoreGetter<S>>
->(id: Id, buildState: () => S, getters: G) {
+>(
+ id: Id,
+ buildState: () => S,
+ // @ts-ignore
+ getters: G = {}
+) {
let store: CombinedStore<Id, S, G> | undefined
function useStore(): CombinedStore<Id, S, G> {