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

# Installation

> Install ts-chas and set up your project.

## Requirements

`ts-chas` is a TypeScript-first library. You need:

* **TypeScript 4.7 or later** (5.x recommended)
* Node.js 16 or later

## Install the package

<CodeGroup>
  ```bash npm theme={null}
  npm install ts-chas
  ```

  ```bash yarn theme={null}
  yarn add ts-chas
  ```

  ```bash pnpm theme={null}
  pnpm add ts-chas
  ```
</CodeGroup>

## Import what you need

The package ships with a single top-level namespace and several focused sub-path exports. Import only the modules your code uses.

```typescript theme={null}
// The full namespace, includes everything
import { chas } from 'ts-chas';

// Result API only
import type { Result, ResultAsync, ... } from 'ts-chas/result';

// Guard API only
import { is, ... } from 'ts-chas/guard';

// Option API only
import { Option, ... } from 'ts-chas/option';

// .pipe() and .flow() utilities only
import { pipe, flow } from 'ts-chas/pipe';

// Task class only
import { Task } from 'ts-chas/task';

// Tagged Errors API only
import { defineErrs, InferErr, ... } from 'ts-chas/tagged-errs';
```

Using sub-path imports keeps your bundle smaller: your bundler tree-shakes everything in the sub-path rather than the full library.

## ESM and CommonJS

`ts-chas` ships both an ESM build (`dist/index.js`) and a CommonJS build (`dist/index.cjs`). Node.js, bundlers, and runtimes that support the `exports` field in `package.json` automatically receive the correct format with no extra configuration needed.
