Skip to content

Infer TS type from JSON schema #463

Closed
@cyrilletuzi

Description

@cyrilletuzi

Description of the issue

Currently the lib infers the TS type in get/watch from the JSON schema for simple types (string, number, boolean and array of the former), but not for complex arrays or objects, leading to:

  • a double work for the user, who must do the type and the JSON schema
  • we are not sure the type match the JSON schema

It is now possible with today's TypeScript to infer the type from the JSON schema even for complex types.

Note it requires to assert JSON schemas as const (maybe microsoft/TypeScript#30680 could help, but it doesn't seem it will get a solution from TS).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions