Relative Content

Tag Archive for typescripttype-inference

Typescript infers type never on Union of two types

In the following example, in the getAdditionalData function, Typescript infers the type of value to never after validating the type through isBarType. I would expect the type to be FooEntity since Entity can be either FooEntity OR BarEntity.

Typescript wrongly infer type never on Union of two types

In the following example, in the getAdditionalData function, Typescript infers the type of value to never after validating the type through isBarType. I would expect the type to be FooEntity since Entity can be either FooEntity OR BarEntity.