Stores

omit

Returns a reactive proxy of props with the listed keys hidden. Tracking on the remaining keys is preserved.

Use it to forward "rest" props to a child element while pulling out the keys your component handles itself — the equivalent of splitProps(p, ["a","b"])[1].


Import

import { omit } from "solid-js";

Type signature

function omit<T extends Record<any, any>, K extends readonly (keyof T)[]>(
props: T,
...keys: K
): Omit<T, K>;

Examples

function Input(
props: {
label: string;
value: string;
onInput: (v: string) => void;
} & JSX.HTMLAttributes<HTMLInputElement>
) {
const rest = omit(props, "label", "value", "onInput");
return (
<label>
{props.label}
<input
{...rest}
value={props.value}
onInput={(e) => props.onInput(e.currentTarget.value)}
/>
</label>
);
}

Omit

type Omit<T, K extends readonly (keyof T)[]> = {
[P in keyof T as Exclude<P, K[number]>]: T[P];
};
Last updated: 7/4/26, 6:21 PMEdit this pageReport an issue with this page