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

Passing null or undefined fails without a helpful error #12

Open
DominicSherman opened this issue May 20, 2022 · 1 comment
Open

Passing null or undefined fails without a helpful error #12

DominicSherman opened this issue May 20, 2022 · 1 comment

Comments

@DominicSherman
Copy link
Contributor

Might not want to allow it, but if so should update the type definition to explicitly disallow it or throw a more helpful error

@andrewmclagan
Copy link

I think the issue comes from the fact that undefined properties of objects are still properties of the object:

if(o.myProperty === undefined) {
  alert("myProperty value is the special value `undefined`");
}

// versus...

if(!o.hasOwnProperty('myProperty')) {
  alert("myProperty does not exist");
}

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