Infer TS type from JSON schema #557
cyrilletuzi
started this conversation in
General
Replies: 1 comment
-
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 in microsoft/TypeScript#41247, but it doesn't seem it will get a solution from TS. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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: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).Beta Was this translation helpful? Give feedback.
All reactions