Generate runtypes from static types & JSON schema.
npm install runtypes
npm install -D runtypes-generator
# runtypes.gen.yml
# This config represents a list of files to create.
- targetFile: src/runtypes.ts # The file to create
sourceTypes:
- file: src/types.ts # The file where your type lives
type: Foo # The type you want to convert to a runtype
- file: json/my-json-schema.json # You can even use JSON schema files!!
type: ExampleType
npx rungen