Skip to content

boolean | null prop doesn't accept null value #12882

@jacekkarczmarczyk

Description

@jacekkarczmarczyk

Version

2.7.14

Reproduction link

stackblitz.com

Steps to reproduce

// Comp.vue
defineProps<{ msg: boolean | null }>();
<!-- App.vue -->
<template>
  <Comp :msg="null" />
</template>

What is expected?

No warnings
Vue 3: https://sfc.vuejs.org/#__DEV__eNp9kLtuwzAMRX+F0JIEiKXdcAMU3Tq0BbpqcRzaVWA9QMkpClf/XqrpIw8gmy55eUWeWdyHIA8Tilo0sSMTEkRMU9hoZ2zwlODB2wA9eQsLqYoo9oV2jTr62ckioQ1jm5AVQNOVmbr3/k4LN42jFqC406g/m1iLY35l2yD30TveYC7D+qcRtajhu1Jq/GfRWrylFGKtVOy7ssg+Sk+D4pekySVjUWK01Zb8e0TiYC3WJxmKiwekitDtkJBuZV5Yr3JLbNYu8ym/WC4pwti6gRmUY/j+HfbG4Qv5EJsZGE8NW+9HbB18QuEEebNcnaH9BzvP8Pj6/CRjIuMG038sOWAFOZ9SzV97tqJr

What is actually happening?

Invalid prop type: "null" is not a constructor and Invalid prop: type check failed for prop "msg". Expected Boolean, , got Null warnings

Additional notes

Warnings per se are not the issue, they can be fixed by changing the prop definition to msg?: boolean which also accepts booleans, the issue is that this behaviour is not same as in Vue 3

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