Is there a way to check the type of an output? e....
# typescript
w
Is there a way to check the type of an output? e.g.
Copy code
typeof myStringOutput === "object"
is there a way to test for pulumi.Output<string> in a guard or something?
w
Not really. As with almost everything related to Output the answer is generally to use apply and test the type of the value inside the callback. But how that will work with the rest of your code depends on more details of what you are trying to do. Note that typescript types are not actually available at runtime - so there is not even really a concept of type testing an
Output<string>
as the actual runtime value involved is just an Output (and the value it will eventually provide can’t be type tested until it’s available, i.e. inside an apply).
w
ok got it, thanks for the clarity, Luke