'How do I explicitly declare the type of the variable as object in Haxe?
If I have a variable called str that is a String, I can do the following
var str:String = "value";
However, I don't know what kind of type I need to use for a generic object like this
var myObj:???? = {
key1: value1,
key2: value2
}
I know I don't need to declare it but I still want to know what the proper text is in place of ????
Type.typeof() says it's a TObject but I can't use that.
Solution 1:[1]
it depends on key types but you might want something like this:
var myObj:{key1:String, key2:String} = {
key1: "foo",
key2: "bar"
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | gogoprog |
