how do i access the value behind an Output?
# general
r
how do i access the value behind an Output?
b
with the apply function
typescript:
Copy code
const newOutput = theOutput.apply(theValue => {
 do whatever you want with value
})
r
I saw that, thanks... i don't think it'll do what i need.
I want to return a list of uris for uploaded blobs in an Output i think that needs to be an Output<ImmutableArray<string>> NOT Output<ImmutableArray<Output<string>>> so to do that i need to access the string behind Blob.SourceUri...
w
In general
.all
should let you turn an array of ourputs into an output of an array - which sounds like what you are looking for?
r
.All would let me apply something on all the elements yes, but if i have Output<string> how do i then turn that into just a string?
m
pulumi.all().apply() will give you the strings of those outputs as an array of just-strings. It might be easier to go into more detail if you could share a snip if your code, though, assuming you’ve tried that already.
r
I've achieved what i wanted to do by changing the types within my array from Output<string> to object? eg public Output<ImmutableArray<object?>> UploadedUri { get; set; } instead of public Output<ImmutableArray<Output<string>> UploadedUri { get; set; }
it seems to be the way as the examples return dicts of <string, object?> - it is quite messy.... but works i guess