COMMUNITY

Weird type inference with EitherType


#1

Hello here,

I’ve seen a weird behavior using js.Promise, with the type inference when using haxe.extern.EitherType.

Here’s a reproduction of the behavior :
https://try.haxe.org/#8B823

The direct consequence is when you subscribe to a Promise, the type of the first parameter in the then callback is Unknown<0> instead of T.

Am I doing something wrong, or is that a bug with EitherType ?


(Ben Merckx) #2

That’s type inference at work, since the b argument itself is not typed: https://haxe.org/manual/type-system-type-inference.html