Do not use the Union library because it is macro-diven and thus unstable. Just use type parameters.
class TestClass {
public function new<T>(arg: T){
if(arg is Int){
...
}
if(arg is String){
...
}
}
}
Haxe stupidly wants you to do this with abstracts or something. These are nontrival solutions to achieve a trivial convinience. My suggestion is to write a VSCode extension to generate an abstract from a prompt of types and then use that. If I make one I'll add it here.