Description
Infer TS types from JSON schemas π. Contribute to ThomasAribart/json-schema-to-ts development by creating an account on GitHub.
Summary
- The as const statement is used so that TypeScript takes the schema definition to the word (e.g.
- true is interpreted as the true constant and not widened as boolean).
- It is pure TypeScript and has zero impact on the compiled code.
-
2},}asconst;typeOddNumber=FromSchema
;// => should and will resolve to "number"constincorrectSchema={type: " Definitions Since the introduction of template literal types with Typescript 4.1, the definitions keyword seems implementable in json-schema-to-ts.