ArrayElement<T> types.ts
Declarations #
15 declarations
ArrayElement #
Assignable #
Assignable<T, K> generics
T
K
keyof Tkeyof TBrand #
Brand<T> generics
T
Branded #
Branded<TValue, TName> generics
TValue
TName
ClassConstructor #
ClassConstructor<TInstance, TArgs> generics
TInstance
TArgs
Array<any>Array<any>Defined #
Defined<T> generics
T
Flavor #
Flavor<T> generics
T
Flavored #
Flavored<TValue, TName> The Flavored and Branded type helpers add varying degrees of nominal typing to other types. This is especially useful with primitives like strings and numbers.
generics
TValue
TName
see also
https://spin.atomicobject.com/typescript-flexible-nominal-typing/ * Flavored is a looser form of Branded that trades explicitness and a little safety in some cases for ergonomics. With Flavored you don't need to cast unflavored types: * ``
ts type Email = Flavored<string, 'Email'>; const email1: Email = 'foo'; // ok type Address = Flavored<string, 'Address'>; const email2: Email = 'foo' as Address; // error!`` * Branded requires casting: * ``ts type PhoneNumber = Branded<string, 'PhoneNumber'>; const phone1: PhoneNumber = 'foo'; // error! const phone2: PhoneNumber = 'foo' as PhoneNumber; // ok`` * See also Zod's.brandschema helper: *
KeyofUnion #
KeyofUnion<T> Like keyof but works for type unions.
generics
T
see also
NotNull #
NotNull<T> generics
T
OmitStrict #
OmitStrict<T, K> generics
T
K
keyof TPartialExcept #
PartialExcept<T, K> generics
T
K
keyof TPartialOnly #
PartialOnly<T, K> generics
T
K
keyof TPartialValues #
PartialValues<T> generics
T
PickUnion #
PickUnion<T, K> Like Pick but works for type unions.
generics
T
K
KeyofUnion<T>