The package is used to generate typescript types using Swagger documentation.
yarn add ts-swagger-typegen
Add a typegen.config.json
with content:
{
"dev": {
"url": "<url_to_swagger>",
"title": "<title>",
"location": "<location_to_save_types>"
}
}
"scripts": {
"typegen": "ts-swagger-typegen"
}
yarn typegen dev
You can change
dev
to any environment as specified intypegen.config.json
- Always gitignore the type file
- Add configuration for all the environemnts
- Generate the type before development and during build process
- Eslint configuration
- Add tests
- Generation from multiple swagger
- Service layer code