ivue 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import type { ComputedRef, ExtractPropTypes, Ref, ToRef, UnwrapNestedRefs } from 'vue';
2
+ import type { Ref as DemiRef } from 'vue-demi';
2
3
  import { UnwrapRef } from 'vue';
3
4
  /** Types */
4
5
  /**
@@ -25,11 +26,9 @@ export declare type IVueRefs<T = any> = {
25
26
  /**
26
27
  * Unwraps the returned Refs of composable method T to a reactive type definition.
27
28
  */
28
- export declare type UseComposableReturn<T extends Record<string, Ref | any>> = {
29
- [K in keyof T]: T[K] extends Ref ? T[K]['value'] extends Ref ? T[K]['value']['value'] : T[K]['value'] : T[K] extends {
30
- value: any;
31
- } ? T[K]['value'] : T[K];
32
- };
29
+ export declare type UseComposableReturn<T> = {
30
+ [K in keyof T]: T[K] extends Ref | DemiRef ? T[K]['value'] | (T[K]['value'] extends object ? UseComposableReturn<T[K]> : never) : T[K];
31
+ }[keyof T];
33
32
  export declare type UseComposable<T extends (...args: any[]) => any> = UseComposableReturn<ReturnType<T>>;
34
33
  /**
35
34
  * Extracts object defined emit types by converting them to a plain interface
@@ -31,8 +31,6 @@ class Counter {
31
31
  sum: this.sum,
32
32
  total: this.total
33
33
  } = iuse(useMouse()));
34
- const dark = iuse(useDark());
35
- dark.value
36
34
  }
37
35
  }
38
36
 
@@ -8,9 +8,13 @@ export function useMouse() {
8
8
  function sum() {
9
9
  _sum.value = x.value + y.value;
10
10
  }
11
+
12
+ const total2 = computed(() => {
13
+ return _sum;
14
+ });
11
15
 
12
16
  const total = computed(() => {
13
- return _sum;
17
+ return total2;
14
18
  });
15
19
 
16
20
  return {
package/docs/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "eslint-plugin-import": "^2.29.1",
19
19
  "eslint-plugin-vue": "^9.14.1",
20
20
  "execa": "^8.0.0",
21
- "ivue": "^1.1.6",
21
+ "ivue": "^1.1.8",
22
22
  "typescript": "^4.5.4",
23
23
  "vite-plugin-dynamic-import": "^1.5.0",
24
24
  "vite-tsconfig-paths": "^4.3.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ivue",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Infinite Vue – Class Based Architecture for Vue 3",
5
5
  "type": "module",
6
6
  "exports": {
@@ -80,5 +80,6 @@
80
80
  "name": "Evgeny Kalashnikov",
81
81
  "email": "ekalashnikov@gmail.com"
82
82
  },
83
- "license": "MIT"
83
+ "license": "MIT",
84
+ "dependencies": {}
84
85
  }
package/src/ivue.ts CHANGED
@@ -41,16 +41,14 @@ export type IVueRefs<T = any> = {
41
41
  /**
42
42
  * Unwraps the returned Refs of composable method T to a reactive type definition.
43
43
  */
44
- export type UseComposableReturn<T extends Record<string, Ref | any>> =
45
- T extends Ref | DemiRef
46
- ? T['value']
47
- : {
48
- [K in keyof T]: T[K] extends Ref | DemiRef // Handle Ref
49
- ? T[K]['value'] extends Ref | DemiRef // Handle Double Wrapped Ref: Most often a Ref that is inside a Computed Ref
50
- ? T[K]['value']['value'] // Return doubly wrapped internal value
51
- : T[K]['value'] // Handle Standard Ref or Computed Ref
52
- : T[K]; // Handle non Ref property or method
53
- };
44
+
45
+ export type UseComposableReturn<T> = {
46
+ [K in keyof T]: T[K] extends Ref | DemiRef
47
+ ?
48
+ | T[K]['value']
49
+ | (T[K]['value'] extends object ? UseComposableReturn<T[K]> : never)
50
+ : T[K];
51
+ }[keyof T];
54
52
 
55
53
  export type UseComposable<T extends (...args: any[]) => any> =
56
54
  UseComposableReturn<ReturnType<T>>;