cdk-from-cfn
cdk-from-cfn copied to clipboard
wrong output - boolean properties
props.myProperty! === 'true';
should be
props.myProperty! === true;
There is not enough information here to solve this issue. Please provide further context where this is showing up.
Oh, issue is not what I thought. It is actually a string property that contains "true" or "false", and it getting output halfway as a boolean and halfway as a string. It should pick one type or the other.
Input:
"Parameters": {
"MyProperty": {
"AllowedValues": [
"true",
"false"
],
"Default": "true",
"Type": "String"
},
Conditions:
MyCondition:
Fn::Equals: [ {Ref: MyProperty}, "true"]
Output:
export interface NoctStackProps extends cdk.StackProps {
/**
* @default 'true'
*/
readonly myProperty?: boolean;
myProperty: props.myProperty ?? true
const myCondition = props.myProperty! === 'true';
Thanks for the clarification!