# @incmix/ts.runtime

> This tool converts TypeScript types into TS Runtime objects.

Latest version **3.0.1** (published 2022-08-04) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @incmix/ts.runtime
pnpm add @incmix/ts.runtime
yarn add @incmix/ts.runtime
bun add @incmix/ts.runtime
```

Provides the command `ts.runtime`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2022-08-04 |
| First published | 2022-05-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 104.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | incmix |

## Links

- npm: https://www.npmjs.com/package/@incmix/ts.runtime
- Repository: https://github.com/uma-uc/ts.runtime
- Homepage: https://github.com/uma-uc/ts.runtime#readme
- Issues: https://github.com/uma-uc/ts.runtime/issues
- npm.io page: https://npm.io/package/@incmix/ts.runtime

## Dependencies (3)

- [commander](https://npm.io/package/commander.md) ^9.2.0
- [typescript](https://npm.io/package/typescript.md) ^4.6.3
- [@changesets/cli](https://npm.io/package/@changesets/cli.md) 2.22.0

## Recent versions

- 3.0.1 (latest) — 2022-08-04
- 3.0.0 — 2022-08-04
- 2.5.3 — 2022-07-20
- 2.5.2 — 2022-07-20
- 2.5.1 — 2022-07-20
- 2.5.0 — 2022-07-20
- 2.4.0 — 2022-07-20
- 2.3.0 — 2022-07-15
- 2.2.0 — 2022-07-12
- 2.1.0 — 2022-07-12
- 2.0.2 — 2022-07-12
- 2.0.1 — 2022-07-12
- 2.0.0 — 2022-07-12
- 1.9.0 — 2022-07-12
- 1.8.0 — 2022-07-12
- … 18 more at https://npm.io/package/@incmix/ts.runtime/versions

## README

# ts.runtime

This tool converts TypeScript types into TS Runtime objects.

# Usage - via CLI

Install it globally:

```sh
npm i ts.runtime -g
```

We have this file:

```ts
// test/test.ts
export type Type = string | 4 | 2 | boolean;
```

To convert the type in the file above, we do this:

```
ts.runtime test/test.ts
```

This generates the TS Runtime objects from the types in the file and prints them:

```ts
export type Type = string | 4 | 2 | boolean;

export type TsRuntimeObject_Type = {
  type: "union";
  members: [
    { type: "string" },
    { type: "number"; value: 4 },
    { type: "number"; value: 2 },
    { type: "boolean" }
  ];
};
```

# Usage - via programmatic interface

You can use `ts.runtime` in your projects.

```sh
npm i ts.runtime
```

In our project, we import `generateTSRuntimeObjectFromFile` from `ts.runtime`:

```ts
import { generateTSRuntimeObjectFromFile } from "ts.runtime";

const tsRuntimeObject = generateTSRuntimeObjectFromFile("test/test.ts");
```

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