As a newcomer to the world of Go language, I find myself passing some properties labeled props?
to my CDK appstack using the signature: props?: cdk.StackProps
When I print the variable props
to the console with console.log(props)
, I see the following expected output:
{ env: { account: '112358132134', region: 'us-west-2' } }
However, attempting something like console.log(props['env'])
results in an error message:
error TS2532: Object is possibly 'undefined'.
My goal is to utilize this property for my business logic. What steps can I take to properly retrieve and make use of it?