https://pulumi.com logo
w

worried-engineer-33884

12/20/2019, 5:30 PM
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

white-balloon-205

12/20/2019, 6:35 PM
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

worried-engineer-33884

12/20/2019, 6:41 PM
ok got it, thanks for the clarity, Luke