Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/createTemplatePromise/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ export function createTemplatePromise<Return, Args extends any[] = []>(
// @ts-expect-error There's a breaking type change in Vue 3.3 <https://github.com/vuejs/core/pull/7963>
component.start = start

return component as any
return component as TemplatePromise<Return, Args>
}
4 changes: 2 additions & 2 deletions packages/core/useMagicKeys/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export type UseMagicKeysReturn<Reactive extends boolean>
*/
export function useMagicKeys(options?: UseMagicKeysOptions<false>): UseMagicKeysReturn<false>
export function useMagicKeys(options: UseMagicKeysOptions<true>): UseMagicKeysReturn<true>
export function useMagicKeys(options: UseMagicKeysOptions<boolean> = {}): any {
export function useMagicKeys(options: UseMagicKeysOptions<boolean> = {}): UseMagicKeysReturn<boolean> {
const {
reactive: useReactive = false,
target = defaultWindow,
Expand Down Expand Up @@ -190,7 +190,7 @@ export function useMagicKeys(options: UseMagicKeysOptions<boolean> = {}): any {
},
)

return proxy as any
return proxy as UseMagicKeysReturn<boolean>
}

export { DefaultMagicKeysAliasMap } from './aliasMap'
6 changes: 4 additions & 2 deletions packages/math/useMath/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { reactify } from '@vueuse/shared'

export type UseMathKeys = keyof { [K in keyof Math as Math[K] extends (...args: any) => any ? K : never]: unknown }

export type UseMathReturn<K extends keyof Math> = ReturnType<Reactified<Math[K], true>>

/**
* Reactive `Math` methods.
*
Expand All @@ -13,6 +15,6 @@ export type UseMathKeys = keyof { [K in keyof Math as Math[K] extends (...args:
export function useMath<K extends keyof Math>(
key: K,
...args: ArgumentsType<Reactified<Math[K], true>>
): ReturnType<Reactified<Math[K], true>> {
return reactify(Math[key] as any)(...args) as any
): UseMathReturn<K> {
return reactify(Math[key] as any)(...args) as UseMathReturn<K>
}
2 changes: 1 addition & 1 deletion packages/router/useRouteQuery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ export function useRouteQuery<
{ flush: 'sync' },
)

return proxy as any as Ref<K>
return proxy as Ref<K>
}
2 changes: 1 addition & 1 deletion packages/shared/reactify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function reactify<T extends AnyFn, K extends boolean = true>(fn: T, optio
const unrefFn = options?.computedGetter === false ? unref : toValue
return function (this: any, ...args: any[]) {
return computed(() => fn.apply(this, args.map(i => unrefFn(i))))
} as any
} as ReactifyReturn<T, K>
}

// alias
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/reactiveOmit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export function reactiveOmit<T extends object, K extends keyof T>(
return reactiveComputed<any>(() =>
typeof predicate === 'function'
? Object.fromEntries(Object.entries(toRefs(obj)).filter(([k, v]) => !predicate(toValue(v) as T[K], k as K)))
: Object.fromEntries(Object.entries(toRefs(obj)).filter(e => !flatKeys.includes(e[0] as any))))
: Object.fromEntries(Object.entries(toRefs(obj)).filter(e => !flatKeys.includes(e[0] as K))))
}
2 changes: 1 addition & 1 deletion packages/shared/reactivePick/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export function reactivePick<T extends object, K extends keyof T>(
): { [S in K]: UnwrapRef<T[S]> } {
const flatKeys = keys.flat() as K[]
const predicate = flatKeys[0] as unknown as ReactivePickPredicate<T>
return reactiveComputed(() => typeof predicate === 'function' ? Object.fromEntries(Object.entries(toRefs(obj)).filter(([k, v]) => predicate(toValue(v) as T[K], k as K))) : Object.fromEntries(flatKeys.map(k => [k, toRef(obj, k)]))) as any
return reactiveComputed(() => typeof predicate === 'function' ? Object.fromEntries(Object.entries(toRefs(obj)).filter(([k, v]) => predicate(toValue(v) as T[K], k as K))) : Object.fromEntries(flatKeys.map(k => [k, toRef(obj, k)]))) as ReactivePickReturn<T, keyof T | K>
}