Is there a way to generate TypeScript React components based on templates by API?

626 views Asked by At

I would like to generate Typescript React pages or components by using an API and not a CLI tool (like Plop.js) offers for example. The idea is to generate those components from templates based after a tool is run and it should happen behind the scenes without user interacting with the default CLI tools that they usually come in.

Thank you.

2

There are 2 answers

0
Ahmedie-m On BEST ANSWER

I have come across Hygen and used their setup that was noted down in the Readme to setup an API for generating custom components without interacting with any default CLI tools.

1
Abdulrahim Klis On

You can use http://json2ts.com/ for this issue. Or also there is package https://www.npmjs.com/package/json-to-ts