UNPKG

typedash

Version:

modern, type-safe collection of utility functions

12 lines (10 loc) 328 B
type MutableMany<T> = T | T[]; type ImmutableMany<T> = T | readonly T[]; /** * Represents a value that can be either a single value or an array of values. */ type Many<T, Type extends 'mutable' | 'immutable' = 'immutable'> = { immutable: ImmutableMany<T>; mutable: MutableMany<T>; }[Type]; export type { Many as M };