FormidableLabs / ts-simplify

CLI tool to compile TypeScript types into simple, alias-free primitives.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ts-simplify

CLI tool to compile TypeScript types into simple, alias-free primitives.

Usage

ts-simplify <source> [output]

This can be run via npx without installation, eg:

npx ts-simplify <source> [output]

Example

If you have a TypeScript file with exported types:

// example-types.ts
type MyType = { a: "A", b: "B", nested: Nested };
type Nested = { c:"C" };
export type MyType = Omit<MyType, 'b'>;

Running this:

ts-simplify ./example-types.ts ./example-types.d.ts

will output this:

// example-types.d.ts
export type MyType = { a: "A", nested: { c: "C" } };

About

CLI tool to compile TypeScript types into simple, alias-free primitives.

License:MIT License


Languages

Language:TypeScript 82.6%Language:JavaScript 17.4%