Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong output - boolean properties #415

Open
TenPotatoes opened this issue Nov 21, 2023 · 3 comments
Open

wrong output - boolean properties #415

TenPotatoes opened this issue Nov 21, 2023 · 3 comments

Comments

@TenPotatoes
Copy link

props.myProperty! === 'true';

should be

props.myProperty! === true;

@TheRealAmazonKendra
Copy link
Collaborator

There is not enough information here to solve this issue. Please provide further context where this is showing up.

@TenPotatoes
Copy link
Author

TenPotatoes commented Feb 22, 2024

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';

@TheRealAmazonKendra
Copy link
Collaborator

Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants