optional
Encapsule une valeur undefined/définie dans un Either, utile pour propager les champs optionnels.
Exemple interactif
Syntaxe
typescript
function optional<
const GenericInput extends unknown = undefined
>(
input: GenericInput
): GenericInput extends undefined
? EitherOptionalEmpty
: EitherOptionalFilled<GenericInput>;Paramètres
input: Peut êtreundefinedou une valeur concrète.
Valeur de retour
EitherOptionalFilledsi la valeur est définie.EitherOptionalEmptysinon.
