ivue 1.1.1 → 1.1.2

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,4 @@
1
- import type { ComputedRef, ExtractPropTypes, ToRef, UnwrapNestedRefs } from 'vue';
1
+ import type { ComputedRef, ExtractPropTypes, Ref, ToRef } from 'vue';
2
2
  import { UnwrapRef } from 'vue';
3
3
  /** Types */
4
4
  /**
@@ -25,12 +25,8 @@ export declare type IVueRefs<T = any> = {
25
25
  /**
26
26
  * Unwraps the returned Refs of composable method T to a reactive type definition.
27
27
  */
28
- export declare type UseComposableReturn<T extends Object> = {
29
- [K in keyof T]: T[K] extends {
30
- value: any;
31
- } ? T[K]['value'] extends {
32
- value: any;
33
- } ? T[K]['value']['value'] : T[K]['value'] : T[K];
28
+ export declare type UseComposableReturn<T extends Record<string, Ref | any>> = T extends Ref ? T : {
29
+ [K in keyof T]: T[K] extends Ref ? T[K]['value'] extends Ref ? T[K]['value']['value'] : T[K]['value'] : T[K];
34
30
  };
35
31
  export declare type UseComposable<T extends (...args: any[]) => any> = UseComposableReturn<ReturnType<T>>;
36
32
  /**
@@ -154,7 +150,7 @@ export declare function iref<T>(val?: T): UnwrapRef<T>;
154
150
  * `iuse` stands for composable.
155
151
  * Returns unwrapped composable type definition without the Refs.
156
152
  */
157
- export declare function iuse<T extends Object>(val?: T): UseComposableReturn<UnwrapNestedRefs<T>>;
153
+ export declare function iuse<T extends Object>(val?: T): UseComposableReturn<T>;
158
154
  /**
159
155
  * Convert reactive ivue class to Vue 3 refs.
160
156
  *
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.0",
21
+ "ivue": "^1.1.1",
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.1",
3
+ "version": "1.1.2",
4
4
  "description": "Infinite Vue – Class Based Architecture for Vue 3",
5
5
  "type": "module",
6
6
  "exports": {
package/src/ivue.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  import type {
4
4
  ComputedRef,
5
5
  ExtractPropTypes,
6
- ToRef,
7
- UnwrapNestedRefs,
6
+ Ref,
7
+ ToRef
8
8
  } from 'vue';
9
9
  import { UnwrapRef, computed, reactive, ref, toRef } from 'vue';
10
10
 
@@ -39,9 +39,9 @@ export type IVueRefs<T = any> = {
39
39
  /**
40
40
  * Unwraps the returned Refs of composable method T to a reactive type definition.
41
41
  */
42
- export type UseComposableReturn<T extends Object> = {
43
- [K in keyof T]: T[K] extends { value: any } // Handle Ref
44
- ? T[K]['value'] extends { value: any } // Handle Double Wrapped Ref: Most often a Ref that is inside a Computed Ref
42
+ export type UseComposableReturn<T extends Record<string, Ref | any>> = T extends Ref ? T : {
43
+ [K in keyof T]: T[K] extends Ref // Handle Ref
44
+ ? T[K]['value'] extends Ref // Handle Double Wrapped Ref: Most often a Ref that is inside a Computed Ref
45
45
  ? T[K]['value']['value'] // Return doubly wrapped internal value
46
46
  : T[K]['value'] // Handle Standard Ref or Computed Ref
47
47
  : T[K]; // Handle non Ref property or method
@@ -318,8 +318,8 @@ export function iref<T>(val?: T): UnwrapRef<T> {
318
318
  */
319
319
  export function iuse<T extends Object>(
320
320
  val?: T
321
- ): UseComposableReturn<UnwrapNestedRefs<T>> {
322
- return val as unknown as UseComposableReturn<UnwrapNestedRefs<T>>;
321
+ ): UseComposableReturn<T> {
322
+ return val as unknown as UseComposableReturn<T>;
323
323
  }
324
324
 
325
325
  /**