API reference@evolu/common › Types

TypeScript utility types.

Functions

FunctionDescription
isPromiseLikeType guard to check if a value is a PromiseLike.

Type Aliases

Type AliasDescription
AwaitableA value that can be awaited.
CallbackA function that receives a value and returns nothing.
CallbackWithTeardownA function that receives a value and optionally returns a teardown function.
DigitSingle digit 0-9. Useful for template literal type validation.
Digit1To23Numeric string 1-23. Useful for hours validation.
Digit1To51Numeric string 1-51. Useful for weeks validation.
Digit1To59Numeric string 1-59. Useful for minutes, seconds validation.
Digit1To6Numeric string 1-6. Useful for days validation.
Digit1To9Digit 1-9. Useful for template literal type validation.
Digit1To99Numeric string 1-99. Useful for years validation.
DistributiveOmitRemoves keys from each member of a union.
ExtractTypeExtracts members of a discriminated union by their type literal.
Int1To100Numeric literal 1-100.
Int1To99Numeric literal 1-99.
LiteralString, number, bigint, boolean, undefined, null
MutableRemoves readonly modifier from all properties of a type.
NewKeysConstrains T to only contain keys not present in Existing.
NullablePartialMakes properties optional if they accept null as a value.
NumberFromStringParses a numeric literal type from a string literal.
PartialPropMakes a specific property of an object optional while keeping others unchanged.
PredicateChecks a condition on a value and returns a boolean.
PredicateWithIndexChecks a condition on a value at a given index and returns a boolean.
RefinementA type guard function that refines type A to a narrower type B.
RefinementWithIndexA type guard function that refines type A to a narrower type B at a given index.
SimplifySimplify an intersection type into a single mapped type.
UnionToIntersectionConverts a union to an intersection.
WidenLiteralInfers a broader type from a specific literal value type.