RequireAtLeastOne<T> Type

Defines a type wherein at least one of the properties of T is required to exist. In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.

 interface Wallet {
   cash?: number;
   card?: CreditCard;
 }

 function payForCoffee(wallet: RequireAtLeastOne<Wallet>) { ... }

Source: @azure/keyvault-certificates.

Defined in

Last Updated: 21 November, 2024