Namespace ts-types
Package: @litert/utils-ts-types
This namespace provides static TypeScript utility types for use in generic constraints, type-level programming, and common type transformations. It contains no runtime code — all exports are compile-time-only type declarations.
Install
Use this package only:
bash
npm i @litert/utils-ts-typesOr install the full bundle:
bash
npm i @litert/utilsAnd then import from it.
ts
import type * as LibUtils from '@litert/utils';
type MyObj = LibUtils.IObject;
// or
import type { IObject } from '@litert/utils';Typings
See Typings.md for all exported interfaces and type aliases.
| Type | Description |
|---|---|
IObject | Base interface for any object value, useful in generic constraints. |
IDict<T, TKey> | Lightweight dictionary type (Record<TKey, T>). |
IFunction<TArgs, TReturn> | Type for any function, useful in generic constraints. |
IAsyncFunction<TArgs, TReturn> | Type for any async function, useful in generic constraints. |
IDeepPartial<T> | Recursively makes all properties of T optional. |
IConstructor<T> | Type for a class constructor. |
IBasicType | Union of all JavaScript primitive types. |
IAdvancedType | Union of all non-primitive types. |
IElementOfArray<T> | Extracts the element type from an array type. |
IMaybeAsync<T> | T or Promise<T>. |
IMaybeArray<T> | T or T[]. |
IToPromise<T> | Wraps T in Promise<T> unless already a Promise. |
IfIsAny<T, TYes, TNo> | Conditional type: resolves to TYes if T is any. |
IfIsNever<T, TYes, TNo> | Conditional type: resolves to TYes if T is never. |
IInstanceOf<T> | Extracts the instance type from a constructor type. |