Files
fuel-price/.agents/skills/vueuse-functions/references/reactiveOmit.md
Ovidiu U 4a3ce4cc1d
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
docs: add advanced skills for Vitest, Pinia, and Vue built-ins
Add comprehensive reference documentation for:
- Vitest: environments, projects/workspaces, type testing, vi utilities
- Pinia: HMR, Nuxt integration, SSR setup
- Vue: built-in components (Transition, Teleport, Suspense, KeepAlive) and advanced directives
2026-04-11 16:28:36 +01:00

87 lines
1.6 KiB
Markdown

---
category: Reactivity
---
# reactiveOmit
Reactively omit fields from a reactive object.
## Usage
### Basic Usage
```ts
import { reactiveOmit } from '@vueuse/core'
const obj = reactive({
x: 0,
y: 0,
elementX: 0,
elementY: 0,
})
const picked = reactiveOmit(obj, 'x', 'elementX') // { y: number, elementY: number }
```
### Predicate Usage
```ts
import { reactiveOmit } from '@vueuse/core'
const obj = reactive({
bar: 'bar',
baz: 'should be omit',
foo: 'foo2',
qux: true,
})
const picked = reactiveOmit(obj, (value, key) => key === 'baz' || value === true)
// { bar: string, foo: string }
```
### Scenarios
#### Selectively passing props to child
```vue
<script setup lang="ts">
import { reactiveOmit } from '@vueuse/core'
const props = defineProps<{
value: string
color?: string
font?: string
}>()
const childProps = reactiveOmit(props, 'value')
</script>
<template>
<div>
<!-- only passes "color" and "font" props to child -->
<ChildComp v-bind="childProps" />
</div>
</template>
```
## Type Declarations
```ts
export type ReactiveOmitReturn<
T extends object,
K extends keyof T | undefined = undefined,
> = [K] extends [undefined] ? Partial<T> : Omit<T, Extract<K, keyof T>>
export type ReactiveOmitPredicate<T> = (
value: T[keyof T],
key: keyof T,
) => boolean
export declare function reactiveOmit<T extends object, K extends keyof T>(
obj: T,
...keys: (K | K[])[]
): ReactiveOmitReturn<T, K>
export declare function reactiveOmit<T extends object>(
obj: T,
predicate: ReactiveOmitPredicate<T>,
): ReactiveOmitReturn<T>
```