Skip to content

Feature request: Allow values to be booleans #134

@mgd722

Description

@mgd722

Is your feature request related to a problem? Please describe.
This is a fairly common scenario:

new ChoiceOption({
    label: 'yes',
    value: true
}),
new ChoiceOption({
    label: 'no',
    value: false
})

I have a yes/no question and I would like the answer to be a boolean so that I don't need to coerce it to a boolean later. Currently, doing this results in this error:

[Vue warn]: Invalid prop: type check failed for prop "value". Expected String, Array, got Boolean with value true.

Because of the way the value prop is configured in Question.vue..

Describe the solution you'd like
Allow booleans to be accepted as values.

Describe alternatives you've considered
let booleanAnswer = question.answer === 'true' ? true : false

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