We have some legacy code that uses UInt values. When converting over to a Haxe/JS project we found this does not give the correct response:
var uint:UInt = 1;
trace("should be true: " + Std.is(uint, UInt));
should be true: false
Uncaught TypeError: Right-hand side of ‘instanceof’ is not callable
Is there another way to check for UInt? Maybe a class name comparison?
That’s not specific to the js target, UInt is an abstract over Int, and abstract aren’t there at runtime so you can’t use Std.is on them.
I don’t think there’s a specific way to find out if a type is an UInt at runtime,
why do you need to do this? There might be a way to do that at compile time.
Thanks for the response, what you say makes sense.
A macro would be able to handle the UInt detection at compile time and store the reflection details if needed, but it looks like we won’t be needing to go that far with this project.