gentle-yak-16991
11/24/2023, 10:31 AMpulumi config set --path 'a.b.x' 1
and then pulumi config get --path 'a.b.x'
which will print 1
. How would I do this in TypeScript? I cannot seem to find an example on how to fetch nested values. The first step is something like this config.requireObject('a')
but as requireObject has a return type of unknown i cannot do dot notation or x in y
notation.clever-sunset-76585
11/25/2023, 6:10 AMrhythmic-orange-74390
11/26/2023, 4:42 PMany
to achieve this
> const x: unknown = { a: { b: { x: "foo" }}};
undefined
> console.log((x as { a: {b: {x: string; }}}).a.b.x)
foo
> console.log((x as any).a.b.x)
foo
rhythmic-orange-74390
11/26/2023, 4:50 PMinterface A {
b: {
x: string;
}
}
const myA = config.requireObject<A>("a"); // generic cast
const x = myA.b.x;