-
-
Notifications
You must be signed in to change notification settings - Fork 669
Object literals #633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is a mention at https://docs.assemblyscript.org/basics#strict-typing
What this doesn't mention is that there is some support currently, for example |
Ah cool. Thanks. I'm trying to use if (listeners[eventName] === undefined) {
listeners[eventName] = []
} So I'm wondering what to do. In the docs:
So a get will crash the program. I guess I need to go through the code base, and make a list of all possible string keys, and initialize them all? |
Hmmm, maybe I need to use an array of array tuples, and findIndex? |
Oh, but I don't think Array can support multiple item types? |
Oh, duh, |
I would love to see object literal support. Is that something that will be possible in the future? If so, can we reopen this? |
We have some plans. See this for example: #338 and #299. But even now you could do something like this: |
Are those (or will those) be supported?
I didn't have any luck trying to make an object literal, so I'm using Map. I didn't see any mention of object literals in the new docs.
The text was updated successfully, but these errors were encountered: