> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ooneex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Types

> Shared TypeScript type definitions and interfaces used as foundational building blocks across the Ooneex ecosystem.

`@ooneex/types` is a types-only package that collects the common type definitions, unions, and interfaces shared across Ooneex 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.

```bash theme={null}
bun add @ooneex/types
```

## 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.

```typescript theme={null}
import type { IBase, StatusType } from "@ooneex/types";

interface Article extends IBase {
  title: string;
  status: StatusType;
}

const article: Article = {
  id: "art_123",
  title: "Hello world",
  status: "draft", // "draft" | "pending" | "active" | "archived" | ...
  isPublic: true,
  createdAt: new Date(),
};
```

Use `FilterResultType<T>` to type the response of any paginated list endpoint, and `HttpMethodType` (backed by the `HTTP_METHODS` tuple) to constrain request methods.

```typescript theme={null}
import type { FilterResultType, HttpMethodType } from "@ooneex/types";

const listArticles = async (): Promise<FilterResultType<Article>> => {
  const resources = await fetchArticles();
  return {
    resources,
    total: 240,
    totalPages: 12,
    page: 1,
    limit: 20,
  };
};

const method: HttpMethodType = "POST"; // "GET" | "POST" | "PUT" | "DELETE" | ...
```

`ScalarType` is a handy union for primitive values, useful when typing loosely-structured records like query params or config maps.

```typescript theme={null}
import type { ScalarType } from "@ooneex/types";

// boolean | number | bigint | string
const params: Record<string, ScalarType> = {
  page: 1,
  active: true,
  query: "ooneex",
};
```

## When to use it

* You are building an Ooneex package or app and want entity shapes (`IBase`), lifecycle states (`StatusType`), or paginated responses (`FilterResultType<T>`) to match across services.
* You need a ready-made union for HTTP methods (`HttpMethodType`), content encodings (`EncodingType`), charsets (`CharsetType`), or primitive scalars (`ScalarType`).
* You want shared types with zero runtime cost, since the package contains no executable code.
* You don't need it for one-off local types that aren't shared between packages — define those inline instead.
