types.ts

view source

Declarations
#

15 declarations

ArrayElement
#

types.ts view source

ArrayElement<T> import type {ArrayElement} from '@fuzdev/fuz_util/types.js';

generics

ArrayElement<T>
T

Assignable
#

types.ts view source

Assignable<T, K> import type {Assignable} from '@fuzdev/fuz_util/types.js';

generics

Assignable<T, K extends keyof T = keyof T>
T
K
constraint keyof T
default keyof T

Brand
#

types.ts view source

Brand<T> import type {Brand} from '@fuzdev/fuz_util/types.js';

generics

Brand<T>
T

Branded
#

types.ts view source

Branded<TValue, TName> import type {Branded} from '@fuzdev/fuz_util/types.js';

generics

Branded<TValue, TName>
TValue
TName

ClassConstructor
#

types.ts view source

ClassConstructor<TInstance, TArgs> import type {ClassConstructor} from '@fuzdev/fuz_util/types.js';

generics

ClassConstructor<TInstance, TArgs extends Array<any> = Array<any>>
TInstance
TArgs
constraint Array<any>
default Array<any>

(construct)

type new (...args: TArgs): TInstance

args

type TArgs

Defined
#

types.ts view source

Defined<T> import type {Defined} from '@fuzdev/fuz_util/types.js';

generics

Defined<T>
T

Flavor
#

types.ts view source

Flavor<T> import type {Flavor} from '@fuzdev/fuz_util/types.js';

generics

Flavor<T>
T

Flavored
#

types.ts view source

Flavored<TValue, TName> import type {Flavored} from '@fuzdev/fuz_util/types.js';

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

Flavored<TValue, TName>
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 .brand schema helper:

KeyofUnion
#

NotNull
#

types.ts view source

NotNull<T> import type {NotNull} from '@fuzdev/fuz_util/types.js';

generics

NotNull<T>
T

OmitStrict
#

types.ts view source

OmitStrict<T, K> import type {OmitStrict} from '@fuzdev/fuz_util/types.js';

generics

OmitStrict<T, K extends keyof T>
T
K
constraint keyof T

PartialExcept
#

types.ts view source

PartialExcept<T, K> import type {PartialExcept} from '@fuzdev/fuz_util/types.js';

generics

PartialExcept<T, K extends keyof T>
T
K
constraint keyof T

PartialOnly
#

types.ts view source

PartialOnly<T, K> import type {PartialOnly} from '@fuzdev/fuz_util/types.js';

generics

PartialOnly<T, K extends keyof T>
T
K
constraint keyof T

PartialValues
#

types.ts view source

PartialValues<T> import type {PartialValues} from '@fuzdev/fuz_util/types.js';

generics

PartialValues<T>
T

PickUnion
#

Imported by
#