my typescript-fu is weak :flushed: how would I ma...
# typescript
a
my typescript-fu is weak 😳 how would I map
azure.types.input.web.NameValuePairArgs[]
to
pulumi.Input<{
        
[key: string]: pulumi.Input<string>;
    
}>
?
l
You can use
pulumi.output("value")
to turn it into a
pulumi.Input<string>
. You'd have to loop over your array and construct your dict using
pulumi.output
, then after the loop wrap the entire dict in
pulumi.output
.
To create an object compatible with
{ [key: string]: pulumi.Input<string> }
you should be able to start with an
any
. Something like
var dict: any = {}
. Then when adding values, use the array-style notation
dict["newvar"] = pulumi.output("newval");
Once you've got it working, you could figure out the correct stronger-type for the
any
, but I'm not sure it'd be worth it...
Note that you might not need to wrap things in
pulumi.output()
, since
pulumi.Input<string>
is a union type of both
string
and
pulumi.Output<string>
. However I have found that working with
pulumi.output()
when solving this sort of issue helps me remember which bits are which. You may be able to remove
pulumi.output()
once you've got things working and strengthened your typescript-fu ;)
a
see my next question, the problem is really with the index call.