K
K
Kovalsky2019-09-10 14:08:34
typescript
Kovalsky, 2019-09-10 14:08:34

Why doesn't typescript complain about a missing required property in a nested object?

There is a simple system of nested objects, for which the typescript for some reason does not indicate quite obvious nested object typing errors, here is an example (ts 3.5.1).
If you delete the 17th line, then ts will complain about the absence of the class property required for the Layout interface . If you remove the 23rd line, then ts will complain about the absence of the type property required for the Element interface . And if you remove the 29th line, then ts will not swear, although the type property , which he so fiercely defended in the previous paragraph, was removed. The same behavior is observed in IDEA which uses ts 3.5.3.


Am I missing something or is this a ts bug?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
forspamonly2, 2019-09-11
@lazalu68

there is a limitation of nesting levels (in the region of five identical generic parameters in depth). they say it doesn't loop forever:
https://github.com/microsoft/TypeScript/issues/239...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question