Skip to content

Convert JSON end-point to TypeScript Interfaces in the command line ๐Ÿš€

Notifications You must be signed in to change notification settings

destinio/make-types-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MTR

Convert JSON end-point to TypeScript Interface

npx make-types-rest

 Usage
    $ mtr --url <urlString>
    $ mtr --url <urlString> --copy
    $ mtr --url <urlString> --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

interface Post {
  userId: number
  id: number
  title: string
  body: string
}

Creds

json-to-ts - https://www.npmjs.com/package/json-to-ts

About

Convert JSON end-point to TypeScript Interfaces in the command line ๐Ÿš€

Topics

Resources

Stars

Watchers

Forks