typescript-type(interface)-generator
Generate interfaces form javascript objects
install
npm install typescript-interface-generator
example
const code = console/** ** CODE OUTPUT ** interface User { id: number; data: Data; } interface Data { name: string; articles: Array<Articles | Articles1>; } interface Articles { id: number; title: string; } interface Articles1 { anotherObject: number; } */
API
createInterfacesFromObject
Takes a name and a javascript object and returns a string with typescript interfaces
Syntax
Parameters
- string
- name of (parent) interface
- object
- object that should be turned to interfaces
Return value
string: contains typescript interfaces