@@ -543,34 +543,58 @@ export type _GettersTree<S extends StateTree> = Record<
543
543
*/
544
544
export type _ActionsTree = Record < string , _Method >
545
545
546
+ /**
547
+ * @internal
548
+ */
549
+ type _ExtractStateFromSetupStore_Keys < SS > = keyof {
550
+ [ K in keyof SS as SS [ K ] extends _Method | ComputedRef ? never : K ] : any
551
+ }
552
+
553
+ /**
554
+ * @internal
555
+ */
556
+ type _ExtractActionsFromSetupStore_Keys < SS > = keyof {
557
+ [ K in keyof SS as SS [ K ] extends _Method ? K : never ] : any
558
+ }
559
+
560
+ /**
561
+ * @internal
562
+ */
563
+ type _ExtractGettersFromSetupStore_Keys < SS > = keyof {
564
+ [ K in keyof SS as SS [ K ] extends ComputedRef ? K : never ] : any
565
+ }
566
+
567
+ /**
568
+ * @internal
569
+ */
570
+ type _UnwrapAll < SS > = { [ K in keyof SS ] : UnwrapRef < SS [ K ] > }
571
+
546
572
/**
547
573
* @internal
548
574
*/
549
575
export type _ExtractStateFromSetupStore < SS > = SS extends undefined | void
550
576
? { }
551
- : {
552
- [ K in keyof SS as SS [ K ] extends _Method | ComputedRef
553
- ? never
554
- : K ] : UnwrapRef < SS [ K ] >
555
- }
577
+ : _ExtractStateFromSetupStore_Keys < SS > extends keyof SS
578
+ ? _UnwrapAll < Pick < SS , _ExtractStateFromSetupStore_Keys < SS > > >
579
+ : never
556
580
557
581
/**
558
582
* @internal
559
583
*/
560
584
export type _ExtractActionsFromSetupStore < SS > = SS extends undefined | void
561
585
? { }
562
- : {
563
- [ K in keyof SS as SS [ K ] extends _Method ? K : never ] : SS [ K ]
564
- }
586
+ : _ExtractActionsFromSetupStore_Keys < SS > extends keyof SS
587
+ ? Pick < SS , _ExtractActionsFromSetupStore_Keys < SS > >
588
+ : never
565
589
566
590
/**
567
591
* @internal
568
592
*/
569
593
export type _ExtractGettersFromSetupStore < SS > = SS extends undefined | void
570
594
? { }
571
- : {
572
- [ K in keyof SS as SS [ K ] extends ComputedRef ? K : never ] : UnwrapRef < SS [ K ] >
573
- }
595
+ : _ExtractGettersFromSetupStore_Keys < SS > extends keyof SS
596
+ ? _UnwrapAll < Pick < SS , _ExtractGettersFromSetupStore_Keys < SS > > >
597
+ : never
574
598
575
599
/**
576
600
* Options passed to `defineStore()` that are common between option and setup
0 commit comments