ivue 1.1.1 → 1.1.3

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, UnwrapNestedRefs } 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
  /**
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { useMouse } from './functions/useMouse';
3
- import { ivue, iuse, iref, type UseComposable } from '../../../../src/ivue';
3
+ import { ivue, iuse, iref, type UseComposable } from 'ivue';
4
4
 
5
5
  /**
6
6
  * Use the ivue Utility Type: UseComposable<typeof YourComposableFunctionName>
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.2",
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.3",
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,9 @@
3
3
  import type {
4
4
  ComputedRef,
5
5
  ExtractPropTypes,
6
+ Ref,
6
7
  ToRef,
7
- UnwrapNestedRefs,
8
+ UnwrapNestedRefs
8
9
  } from 'vue';
9
10
  import { UnwrapRef, computed, reactive, ref, toRef } from 'vue';
10
11
 
@@ -39,9 +40,9 @@ export type IVueRefs<T = any> = {
39
40
  /**
40
41
  * Unwraps the returned Refs of composable method T to a reactive type definition.
41
42
  */
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
43
+ export type UseComposableReturn<T extends Record<string, Ref | any>> = T extends Ref ? T : {
44
+ [K in keyof T]: T[K] extends Ref // Handle Ref
45
+ ? T[K]['value'] extends Ref // Handle Double Wrapped Ref: Most often a Ref that is inside a Computed Ref
45
46
  ? T[K]['value']['value'] // Return doubly wrapped internal value
46
47
  : T[K]['value'] // Handle Standard Ref or Computed Ref
47
48
  : T[K]; // Handle non Ref property or method