omit

Commons
stable

Returns a shallow clone of an object with the specified keys removed. The original object is not mutated. TypeScript narrows the return type to Omit<T, U>.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

obj
requis
T
The source object. A shallow clone is created before removing keys.
exclude
requis
Array<U>
Array of key names to exclude from the clone. TypeScript enforces that each key exists on T.

API

Valeur de retour

La valeur retournée par cet util.

A new object of type Omit<T, U> containing all properties of obj except those listed in exclude.

Usage

Exemples

Extraits de code prêts à coller.

Remove internal props before passing to a child

typescript