Skip to content

Commit

Permalink
fix(types): reactiveOmit and reactivePick support array as second…
Browse files Browse the repository at this point in the history
… arg (#1742)
  • Loading branch information
Brain777777 committed Jul 6, 2022
1 parent 79e3257 commit dd94d76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/shared/reactiveOmit/index.ts
Expand Up @@ -8,7 +8,7 @@ import { reactiveComputed } from '../reactiveComputed'
*/
export function reactiveOmit<T extends object, K extends keyof T>(
obj: T,
...keys: K[]
...keys: (K | K[])[]
): Omit<T, K> {
return reactiveComputed<any>(() => Object.fromEntries(Object.entries(toRefs(obj)).filter(e => !keys.includes(e[0] as any))))
}
2 changes: 1 addition & 1 deletion packages/shared/reactivePick/index.ts
Expand Up @@ -8,7 +8,7 @@ import { reactive, toRef } from 'vue-demi'
*/
export function reactivePick<T extends object, K extends keyof T>(
obj: T,
...keys: K[]
...keys: (K | K[])[]
): { [S in K]: UnwrapRef<T[S]> } {
return reactive(Object.fromEntries(keys.map(k => [k, toRef(obj, k)]))) as any
}

0 comments on commit dd94d76

Please sign in to comment.