full-dress-10026
03/14/2019, 6:37 PMStackReference
, how do you get the output as an array? I tried this:
let subnetIds = myStack.getOutput("subnetIds") as pulumi.Output<string[]>;
but Typescript fails with: TS2740: Type 'Output<any>' is missing the following properties from type 'Input<string>[]': length, pop, push, concat, and 26 more..
. I'm fairly certain the type of getOutput
is correct.important-leather-28796
03/14/2019, 6:38 PMpulumi.Output<pulumi.Output<string>[]>
import {Output} from '@pulumi/pulumi'
to shorten it upOutput<any>
, I was thinking Input typesfull-dress-10026
03/14/2019, 6:40 PMTS2740: Type 'Output<Output<string>[]>' is missing the following properties from type 'Input<string>[]': length, pop, push, concat, and 26 more.
important-leather-28796
03/14/2019, 6:40 PMfull-dress-10026
03/14/2019, 6:43 PMgetOutput
. If I do
myStack.getOutput("subnetIds").apply(x => { console.log(x); return x;})
x
is printed as an array.important-leather-28796
03/14/2019, 6:45 PMgetOutput
return type is overly vague since it could be one of many. It could possibly be parameterized to allow a return type, like getOutput<string[]>
to provide a better dev experience. As-is it is a cast either way to what you want to use.full-dress-10026
03/14/2019, 6:50 PMlet subnetIds = myStack.getOutput("subnetIds") as pulumi.Output<string[]>;
const vpc = awsx.ec2.Vpc.fromExistingIds("infra-vpc", {
vpcId: vpcId,
publicSubnetIds: subnetIds,
});
and the error is on the publicSubnetIds
line.Output<Output<string>[]>
but publicSubnetIds
doesn't like that either.lemon-spoon-91807
03/15/2019, 3:52 AMInput<Input<string>[]>
Output<string[]>
pulumi.output(the_inputs)