Skip to main content
@talosjs/types is a types-only package that collects the common type definitions, unions, and interfaces shared across Talos packages. It has no runtime code, so importing from it adds nothing to your bundle. Use it to keep entity shapes, status values, HTTP methods, and paginated results consistent everywhere.

Installation

Add the package with Bun.

Usage

Because the package only ships types, you import them with import type and use them to annotate your own values, functions, and entities. Use IBase as the common shape for persisted entities, and StatusType to constrain a record’s lifecycle state to a known set of values.
Use FilterResultType<T> to type the response of any paginated list endpoint, and HttpMethodType (backed by the HTTP_METHODS tuple) to constrain request methods.
ScalarType is a handy union for primitive values, useful when typing loosely-structured records like query params or config maps.

When to pull these in

The point is consistency across a Talos app or package: entity shapes (IBase), lifecycle states (StatusType), and paginated responses (FilterResultType<T>) line up the same way in every service. The package also carries ready-made unions you’d otherwise rewrite, for HTTP methods (HttpMethodType), content encodings (EncodingType), charsets (CharsetType), and primitive scalars (ScalarType). Because there’s no executable code, none of this reaches your bundle. For one-off local types that aren’t shared between packages, just define them inline.