kind-room-82948
05/26/2022, 6:06 PMrequireOutput()
from the stack reference it always ends up as Output<any>
type. Is there a way to set the expected type of the output so I can get something like pulumi.Output<string>
or other types?orange-policeman-59119
05/27/2022, 6:59 AMas Output<string>
, or if that doesn't work, as any as Output<string>
.
A helper library like this one contains type guards like "is.string". You'd need to use that inside an Apply and decide how to handle the else case - throwing an error in the Apply would work.
https://www.npmjs.com/package/@sindresorhus/isrequireOutput(...).apply(x => {
if is.string(x) {
return x;
} else {
throw new Error("expected a string!")
});
kind-room-82948
05/31/2022, 6:23 PMexport = async () => {
const pulumiStackReference = new pulumi.StackReference(`otherStack`);
const myOutput = await pulumiStackReference.requireOutputValue('myOutput')
}