Are there feelings on arrays of interfaces vs maps...
# typescript
a
Are there feelings on arrays of interfaces vs maps in typescript? I have an "org" pulumi project for managing all the cross role organization configuration, as well as DNS. At the moment it's just a big array of json'y looking
[{"Name":"", "Email": "", "Tags":"", "AdminRoles":[], "RORoles":[], "ZoneDelegation":[]}]
. It's a gross, but working fine. When I was just doing the roles, it was pretty easy to use a single loop where I created a provider per account. Now that I've added DNS, I'm thinking I'd like to have a single provider per account that I can pass around instead of a provider per account per type of activity. Seems like it could easily be an array of interfaces, that I access the right account provided doing some map/filters, or it could be a map type of
<string, aws.Provider>
. Y'all got thoughts on which method may be prefered? Or should I go traipsing down the "turn your big gross json blob into objects, and store the provider in an account member" path?
I'll start,
Map.get(key)
can return as undefined, even if you use
Map.has(key)
before it. Kind of a bummer to have to use
!
every
.get
.