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

default value for Boolean is NOT undefined, it is false, which is inconsistent with other types #5419

Closed
tomwang1013 opened this issue Apr 12, 2017 · 3 comments

Comments

@tomwang1013
Copy link

Version

2.2.6

Reproduction link

https://jsfiddle.net/15ku6ck7/1/

Steps to reproduce

Just run the jsfiddle, it will output: "b is not undefined, it is: false; s is undefined"
b is of Boolean type, s is of String type

What is expected?

b is also undefined if not provided

What is actually happening?

b is false

@yyx990803
Copy link
Member

This is a feature, not a bug. I can't think of a case where undefined is more useful - and changing it would be a breaking change for little gain.

@tomwang1013
Copy link
Author

tomwang1013 commented Apr 12, 2017

@yyx990803 Sometimes i want to know whether a prop is provided by parent component, so i check if it is undefined

@liuqiang1357
Copy link

@yyx990803 +1

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

3 participants