ObjectMap Not working as expected

34 views
Skip to first unread message

hosey hosey

unread,
Aug 22, 2016, 5:10:43 PM8/22/16
to haxe...@googlegroups.com
I am targeting JS.  The below code appears to work in Flash but no in JS
class Main {
static function main()  {
var Users:ObjectMap<String,User> = new ObjectMap();
Users.set("111a",{"id":"6f786e56-2405-4d6f-a6b9-550665b9990f", "email":"em", "name":"hosey"});
}
}
typedef User={
var id:String;
var email:String;
var name:String;
}

Main.hx:192 TypeError: Cannot create property '__id__' on string '111a '(…)

Is there a better Map to use in this case? I am using a Haxe nightly currently.  I just need a unique identifier and a User class.

Cheers

Alexander Kuzmenko

unread,
Aug 22, 2016, 5:24:54 PM8/22/16
to Haxe
You should use Map<String,User> or StringMap<User> instead of ObjectMap

вторник, 23 августа 2016 г., 0:10:43 UTC+3 пользователь hoseyhosey написал:

hosey hosey

unread,
Aug 22, 2016, 5:35:05 PM8/22/16
to haxe...@googlegroups.com
I knew it had to be obvious.  Thank you

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages