3.0.1 • Published 2 years ago

@incmix/ts.runtime v3.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

ts.runtime

This tool converts TypeScript types into TS Runtime objects.

Usage - via CLI

Install it globally:

npm i ts.runtime -g

We have this file:

// 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:

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.

npm i ts.runtime

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

import { generateTSRuntimeObjectFromFile } from "ts.runtime";

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

2 years ago

1.1.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.6.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.0.2

2 years ago

2.5.0

2 years ago

2.4.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.5.3

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago