Skip to content
Advertisement

Typescript Type of JSON schema object

Is there a special type associated with JSON-schema objects in typescript? My class has a method that checks whether its members satisfy the dynamic json schema schema, for now I do it like so,

JavaScript

where for example

JavaScript

But to remain generic I would like to allow for checking arbitrary json schemas, not just this specific one. Is it okay to set schema: object or are there best practices for JSON-schema objects?

Advertisement

Answer

You can use @types/json-schema.

Then:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement