-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
[email protected]: Empty object check error #4632
Comments
Out of curiosity, what's the use case for |
I use it just to create an empty object for storing data, and later I will add keys and values to this empty object. In some cases, it just makes it convenient for me to have fewer declarations, for example, declaring AnyObject explicitly. const data = Object.create(null);
data.a = 1;
const data: AnyObject = {};
data.a = 1; |
@zhe-he : I'm okay with merging the fix, but tbh I'm not sure I see an actual reason to use |
https://github.com/reduxjs/redux/blob/0e8a7b00db58796f7a7adef6ac9ebed9420c18cb/src/utils/isPlainObject.ts#L5C1-L14C2

I just upgraded the package to @reduxjs/[email protected] and [email protected] today, and then I found that the console reported an error, A non-serializable value was detected in the state, in the path. Finally, I found that it was because the object I created through Object.create(null) did not pass the isPlainObject function check. I want to know if this is correct, um... Do not want users to use objects created by Object.create(null) or is this function check not comprehensive enough?
The text was updated successfully, but these errors were encountered: