V
V
Vladimir2021-10-21 15:45:31
typescript
Vladimir, 2021-10-21 15:45:31

Why doesn't typescript accept the parent's type?

Here is an example
https://www.typescriptlang.org/play?#code/KYDwDg9g...

With api comes a list of simple objects and extended ones, for this I made a simple type, an extended one and their combination.
It seems that in the processing I set explicit filtering by the field from the extended type,
but some kind of wild error pops up

No overload matches this call.


PS Why do I not specify the attributes field as optional, in the original there is not one field added, but several, and if the type is extended, they must be present all, or none, then this is a simple type.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WbICHA, 2021-10-21
@Casufi

Because you are trying to apply a particular case to a general one.
https://www.typescriptlang.org/play?#code/KYDwDg9g...
(you forgot the parentheses in the last map)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question