G’day. I have a stack that outputs an array of sub...
# getting-started
p
G’day. I have a stack that outputs an array of subnet IDs:
Copy code
export const privateSubnetIds = vpc.privateSubnetIds;
I have another stack that reads the first stack’s outputs:
Copy code
const privateSubnetIds = vpcStack.requireOutput("privateSubnetIds");
The
requireOutput
function returns an
Output<any>
type. What’s the proper way to cast this back to something like a
string[]
? I searched Slack and found someone else who asked a similar question, but it remained unanswered. Any thoughts?
FWIW, I have this as a workaround:
Copy code
const privateSubnetIds = vpcStack.requireOutput("privateSubnetIds") as unknown as string[];
but that seems kind of hacky..
h
iirc doesn't requireOutput accept a generic argument i.e.
const privateSubnetIds = vpcStack.requireOutput<string[]>("privateSubnetIds")
(Sorry haven't got a pulumi project in front of me atm)
p
Hi @helpful-tent-95136, thanks for your suggestion. I attempted that, but my IDE is producing a warning. And it still thinks it’s an
any
type when referenced later.