-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
"TypeError: Cannot use 'in' operator to search for 'names' in bf7823uhvbon3f289ph32f #7381
Comments
So I believe that this fix is appropriate. Because you are setting on a string, which you can do.. but really actually can't. String variables seem a bit.............. weird Take a look at this: I think it's alright to simply make the code say this: if (target.constructor !== String && key in target && !(key in Object.prototype)) {
target[key] = val
return val
} else if (target.constructor == String) {
return undefined
} because properties set on strings are always undefined, so technically the value is being set as the value but then becoming undefined on the next tick.. as evidenced when you open a node terminal, and type |
Feel free to submit a PR that adds a warning on development mode (+ the test ofc 😄 ) |
@posva there won't be any issues with reactivity? |
$set must be used on an object anyways |
Yes, you can look how warnings are implemented and tested and add a warning for the |
will look into vue ,will get ready then start working with you guys.... |
Hi. I have sent a pull request about this issue: #7452 |
According to documentation, https://vuejs.org/v2/api/#vm-set you are supposed to be using it in this way, i think;
|
help me please guys |
Version
2.5.13
Reproduction link
https://jsfiddle.net/49gptnad/905/
Steps to reproduce
Just run it and open the console in a debugger
What is expected?
that the target variable is type checked for being a string before trying to perform the
key in target
line, to prevent a big error messageWhat is actually happening?
a big error message comes up
I'm going to have a look at a fix for it now so I'll post it if I figure it out
The text was updated successfully, but these errors were encountered: