# @arthurka/ts-utils

> Some convenient TS utilities.

Latest version **3.19.0** (published 2026-08-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install @arthurka/ts-utils
pnpm add @arthurka/ts-utils
yarn add @arthurka/ts-utils
bun add @arthurka/ts-utils
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.19.0 |
| Published | 2026-08-25 |
| First published | 2021-05-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | 22.22.3 |
| Dependencies | 2 |
| Unpacked size | 43.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ArthurKa |
| Maintainers | arthurka |

## Links

- npm: https://www.npmjs.com/package/@arthurka/ts-utils
- Repository: https://github.com/ArthurKa/ts-utils
- Homepage: https://github.com/ArthurKa/ts-utils#readme
- Issues: https://github.com/ArthurKa/ts-utils/issues
- npm.io page: https://npm.io/package/@arthurka/ts-utils

## Dependencies (2)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.2
- [ts-toolbelt](https://npm.io/package/ts-toolbelt.md) ^9.6.0

## Recent versions

- 3.19.0 (latest) — 2026-08-25
- 3.18.2 — 2026-07-09
- 3.18.1 — 2026-07-09
- 3.18.0 — 2026-07-09
- 3.17.3 — 2026-06-28
- 3.17.2 — 2025-05-02
- 3.17.1 — 2024-11-25
- 3.17.0 — 2024-11-25
- 3.16.0 — 2024-07-07
- 3.15.0 — 2024-03-12
- 3.14.0 — 2024-01-19
- 3.13.0 — 2024-01-15
- 3.12.0 — 2024-01-10
- 3.11.0 — 2023-11-04
- 3.10.0 — 2023-08-20
- … 51 more at https://npm.io/package/@arthurka/ts-utils/versions

## README

## Usage

```ts
import { checkExactShape, ExactShape } from '@arthurka/ts-utils';

const tooFew = { name: 'Stefan' };
const exact = { name: 'Stefan', age: '31' };
const tooMany = { name: 'Stefan', age: '31', sex: 'male' };

const record: Record<string, string> = {};
type R = typeof record;
type Exact = typeof exact;
interface ExtendedRecord extends Exact, R {}
const extendedRecord: ExtendedRecord = {
  name: 'Stefan',
  age: '31',
  sex: 'male',
};

type Person = {
  name: string;
  age: string;
};


function savePerson<T extends Person>(e: ExactShape<Person, T>) {

}

savePerson(exact);
// @ts-expect-error
savePerson(tooFew);
// @ts-expect-error
savePerson(tooMany);
// @ts-expect-error
savePerson(record);
// @ts-expect-error
savePerson(extendedRecord);

function getPerson(): Person {
  const e = exact;
  // const e = tooFew;
  // const e = tooMany;
  // const e = record;
  // const e = extendedRecord;

  checkExactShape<Person>()(e);
  return e;
}

const person = getPerson();
console.info(person);
```

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