1- import type { ComponentPublicInstance , ComputedRef } from 'vue-demi'
1+ import type { ComponentPublicInstance , ComputedRef , UnwrapRef } from 'vue-demi'
22import type {
33 _GettersTree ,
44 _Method ,
@@ -431,7 +431,7 @@ export function mapActions<
431431/**
432432 * For internal use **only**
433433 */
434- export type _MapWritableStateReturn < S extends StateTree > = {
434+ export type _MapWritableStateReturn < S > = {
435435 [ key in keyof S ] : {
436436 get : ( ) => S [ key ]
437437 set : ( value : S [ key ] ) => any
@@ -442,7 +442,7 @@ export type _MapWritableStateReturn<S extends StateTree> = {
442442 * For internal use **only**
443443 */
444444export type _MapWritableStateObjectReturn <
445- S extends StateTree ,
445+ S ,
446446 T extends Record < string , keyof S > ,
447447> = {
448448 [ key in keyof T ] : {
@@ -464,11 +464,11 @@ export function mapWritableState<
464464 S extends StateTree ,
465465 G extends _GettersTree < S > ,
466466 A ,
467- KeyMapper extends Record < string , keyof S > ,
467+ KeyMapper extends Record < string , keyof UnwrapRef < S > > ,
468468> (
469469 useStore : StoreDefinition < Id , S , G , A > ,
470470 keyMapper : KeyMapper
471- ) : _MapWritableStateObjectReturn < S , KeyMapper >
471+ ) : _MapWritableStateObjectReturn < UnwrapRef < S > , KeyMapper >
472472/**
473473 * Allows using state and getters from one store without using the composition
474474 * API (`setup()`) by generating an object to be spread in the `computed` field
@@ -482,16 +482,11 @@ export function mapWritableState<
482482 S extends StateTree ,
483483 G extends _GettersTree < S > ,
484484 A ,
485- Keys extends keyof S ,
485+ Keys extends keyof UnwrapRef < S > ,
486486> (
487487 useStore : StoreDefinition < Id , S , G , A > ,
488488 keys : readonly Keys [ ]
489- ) : {
490- [ K in Keys ] : {
491- get : ( ) => S [ K ]
492- set : ( value : S [ K ] ) => any
493- }
494- }
489+ ) : Pick < _MapWritableStateReturn < UnwrapRef < S > > , Keys >
495490/**
496491 * Allows using state and getters from one store without using the composition
497492 * API (`setup()`) by generating an object to be spread in the `computed` field
0 commit comments