Id extends string,
S extends StateTree,
G extends _GettersTree<S>,
- A
+ A,
+ Keys extends keyof S
>(
useStore: StoreDefinition<Id, S, G, A>,
- keys: Array<keyof S>
-): _MapWritableStateReturn<S>
+ keys: readonly Keys[]
+): { [K in Keys]: S[K] }
/**
* Allows using state and getters from one store without using the composition
* API (`setup()`) by generating an object to be spread in the `computed` field
newToggleA: () => void
}>(mapActions(useStore, { newSetToggle: 'setToggle', newToggleA: 'toggleA' }))
-expectType<{
- a: {
- get: () => 'on' | 'off'
- set: (v: 'on' | 'off') => any
- }
-}>(mapWritableState(useStore, ['a']))
+expectType<{ a: 'on' | 'off' }>(mapWritableState(useStore, ['a']))
+// @ts-expect-error: only defined in array
+mapWritableState(useStore, ['a']).b
expectType<{
newA: {