# @typeschema/ow

> Reusable adapter for Ow schemas

Latest version **0.14.0** (published 2024-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @typeschema/ow
pnpm add @typeschema/ow
yarn add @typeschema/ow
bun add @typeschema/ow
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.14.0 |
| Published | 2024-08-25 |
| First published | 2024-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 451 |
| Author | André Costa |
| Maintainers | decs |
| Keywords | typescript, type, schema, adapter, validation, inference, assert |

## Links

- npm: https://www.npmjs.com/package/@typeschema/ow
- Repository: https://github.com/decs/typeschema
- Homepage: https://typeschema.com
- Issues: https://github.com/decs/typeschema/issues
- npm.io page: https://npm.io/package/@typeschema/ow

## Dependencies (1)

- [@typeschema/core](https://npm.io/package/@typeschema/core.md) 0.14.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 0.14.0 (latest) — 2024-08-25
- 0.13.3 — 2024-03-01
- 0.13.2 — 2024-02-27
- 0.13.1 — 2024-02-23
- 0.13.0 — 2024-02-22

## README

<!-- This file is generated. Do not modify it manually! -->

<img src="https://typeschema.com/assets/logo.png" width="64px" alt="TypeSchema" />
<h1>@typeschema/ow</h1>
<p>
  <a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/decs/typeschema" alt="License"></a>
  <a href="https://bundlephobia.com/package/@typeschema/ow" rel="nofollow"><img src="https://img.shields.io/bundlephobia/minzip/%40typeschema%2Fow" alt="Bundle size"></a>
  <a href="https://www.npmjs.com/package/@typeschema/ow" rel="nofollow"><img src="https://img.shields.io/npm/dw/@typeschema/ow.svg" alt="npm downloads"></a>
  <a href="https://github.com/decs/typeschema/stargazers" rel="nofollow"><img src="https://img.shields.io/github/stars/decs/typeschema" alt="GitHub stars"></a>
</p>
<p>
  Reusable adapter for Ow schemas
  <br />
  <a href="https://typeschema.com">https://typeschema.com</a> ✨
</p>

```ts
import {initTRPC} from '@trpc/server';
import ow from 'ow';

import {wrap} from '@typeschema/ow';

const schema = ow.object.exactShape({name: ow.string});

const t = initTRPC.create();
const appRouter = t.router({
  hello: t.procedure
    .input(wrap(schema))
    .query(({input}) => `Hello, ${input.name}!`),
  //         ^? {name: string}
});

```

Use it directly or through [`@typeschema/main`](https://github.com/decs/typeschema/tree/main/packages/main)

## Dependencies
- [`ow`](https://www.npmjs.com/package/ow): Required for inference and validation (`^0.28.2`)

## API

### Inference
- `Infer<TSchema>`: Extracts the output type of a schema
- `InferIn<TSchema>`: Extracts the input type of a schema

### Validation
- `wrap(schema)`: Returns the wrapped schema with access to its operations
- `validate(schema, data)`: Returns the validated data or a list of validation issues
- `assert(schema, data)`: Returns the validated data or throws an `AggregateError`

---
_Source: https://npm.io/package/@typeschema/ow · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
