Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Infer TS type from JSON schema#557

cyrilletuzi started this conversation inGeneral
Discussion options

Description of the issue

Currently the lib infers the TS type inget/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 schemasas const (maybemicrosoft/TypeScript#30680 could help, but it doesn't seem it will get a solution from TS).

You must be logged in to vote

Replies: 1 comment

Comment options

cyrilletuzi
Nov 5, 2020
Maintainer Author

PR#477

Blocked on Angular supporting TS 4.1 (and TS >= 4.1 only) for recursive conditional types, so probably not before Angular v12.

Also, a DX issue (no IntelliSense when writing the JSON schemas) is discussed inmicrosoft/TypeScript#41247, but it doesn't seem it will get a solution from TS.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
1 participant
@cyrilletuzi
Converted from issue

This discussion was converted from issue #463 on February 12, 2021 16:28.


[8]ページ先頭

©2009-2025 Movatter.jp