https://github.com/destinio/make-types-rest
Convert JSON end-point to TypeScript Interfaces in the command line 🚀
https://github.com/destinio/make-types-rest
cli conversion json type
Last synced: about 1 month ago
JSON representation
Convert JSON end-point to TypeScript Interfaces in the command line 🚀
- Host: GitHub
- URL: https://github.com/destinio/make-types-rest
- Owner: destinio
- Created: 2021-11-24T23:46:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-06T16:26:10.000Z (over 4 years ago)
- Last Synced: 2025-03-15T04:45:06.036Z (over 1 year ago)
- Topics: cli, conversion, json, type
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/make-types-rest
- Size: 44.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## MTR
## Convert JSON end-point to TypeScript Interface
`npx make-types-rest`
```sh
Usage
$ mtr --url
$ mtr --url --copy
$ mtr --url --root post
Options
--url, -u Url to be converted to Types
--root, -r Name of Interface default "RootObject"
--copy, -c Copy output to clipboard
Examples
$ mtr -u https://jsonplaceholder.typicode.com/posts --root post
interface Post {
userId: number;
id: number;
title: string;
body: string;
}
```
## Usage
### Install
`npm i -g make-types-rest`
### Run in command line
`make-types-rest -u https://jsonplaceholder.typicode.com/posts --root post`
or
`mtr -u https://jsonplaceholder.typicode.com/posts -r post -c`
### Output
```typescript
interface Post {
userId: number
id: number
title: string
body: string
}
```
## Creds
json-to-ts - https://www.npmjs.com/package/json-to-ts