Skip to content

Review boolean declaration option parsing #885

@aciccarello

Description

@aciccarello

In PR #845, a question came up about the parsing of boolean declaration options.

case ParameterType.Boolean:
value = (typeof value === void 0 ? true : !!value);
break;

The original code was written to return true if the option is undefined and the truthy value of the option otherwise. It was noted by @Gerrit0 that typeof will always return a string, therefore the typeof check will always return false and the expression should be simplified to value = !!value;.

Since there is likely a bug in this code, it should be thoroughly reviewed and corrected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions