Skip to content

Commit 4631677

Browse files
committed
chore: release v0.2.8
1 parent bb7b34b commit 4631677

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

lerna.json

+5
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
"packages": [
44
"packages/*"
55
],
6+
"command": {
7+
"publish": {
8+
"message": "chore(release): publish"
9+
}
10+
},
611
"version": "0.2.7"
712
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vueblocks/vue-use-utilities",
3-
"version": "0.2.8",
3+
"version": "0.2.7",
44
"description": "A collection of Vue composition-api utilities",
55
"scripts": {
66
"docs:dev": "vuepress dev docs",

packages/core/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export * from './useShortcut'
1515
export * from './useStateshot'
1616
export * from './useResizeObserver'
1717
export * from './useWindowSize'
18-
export * from './utils'
18+
export { reactiveFn } from './utils'

packages/core/types/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export type {
55
export type {
66
RefTyped,
77
RefElement,
8-
ToRefs
8+
ToRefs,
9+
ReactiveFn
910
} from './ref'
1011

1112
export type {

packages/core/types/ref.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import { Ref } from 'vue-demi'
1+
import { Ref, ComputedRef } from 'vue-demi'
22

33
export type RefTyped<T> = T | Ref<T>
44
export type RefElement = Element | Ref<Element | undefined>
55
export type ToRefs<T = any> = { [K in keyof T]: Ref<T[K]> }
6+
export type ReactiveFn<T> = T extends (...args: infer A) => infer R
7+
? (...args: { [K in keyof A]: RefTyped<A[K]> }) => ComputedRef<R>
8+
: never

packages/core/utils/ref.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { isRef, ref, Ref, computed, unref, ComputedRef } from 'vue-demi'
1+
import { isRef, ref, Ref, computed, unref } from 'vue-demi'
22

3-
import { RefTyped, RefElement } from '../types'
3+
import { RefTyped, RefElement, ReactiveFn } from '../types'
44

55
export function unwrap<T>(o: RefTyped<T>): T;
66
export function unwrap<T>(o: RefTyped<T>): T {
@@ -13,10 +13,6 @@ export function wrap(o: any): any {
1313
return isRef(o) ? o : ref(o); // NOTE in v3 this is not necessary
1414
}
1515

16-
export type ReactiveFn<T> = T extends (...args: infer A) => infer R
17-
? (...args: { [K in keyof A]: RefTyped<A[K]> }) => ComputedRef<R>
18-
: never
19-
2016
export function reactiveFn<T extends Function>(fn: T): ReactiveFn<T> {
2117
return function (this: any, ...args: any[]) {
2218
return computed(() => fn.apply(this, args.map(v => unref(v))))

0 commit comments

Comments
 (0)