Cannot read property 'type' of undefined (destructuring props)
See original GitHub issueconst NextComposed = React.forwardRef((props, ref) => {
const { as, href, prefetch, ...other } = props;
Cannot read property ‘type’ of undefined Occurred while linting
"extends": ["airbnb"],
"parser": "babel-eslint",
"env": {
"node": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
eslint v6.4.0
in vscode window at eslint plugin
Parsing error: Unexpected token
23 |
24 | const NextComposed = React.forwardRef((props, ref) => {
> 25 | const { as, href, prefetch, .other } = props;
| ^
26 | return (
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:7 (2 by maintainers)
Top Results From Across the Web
cannot read property of null doing destructing - Stack Overflow
In Javascript, a variable can be assigned a default, in the case that the value unpacked from the object / array is undefined....
Read more >Prevent Error with Default {} when Destructuring
When you use destructuring, make sure to set a default value of empty `{}` to prevent it ... This is because you can't...
Read more >cannot read properties of undefined (reading 'push') history
There are multiple reasons the "Cannot read property push of undefined" error occurs: Calling the push method on a variable that stores an...
Read more >Overzealous Destructuring | Aleksandr Hovhannisyan
Destructuring in JavaScript has many clever uses that can make your code more ... Uncaught TypeError: Cannot read properties of null.
Read more >React TypeError: Cannot read property 'props' of undefined
The "Cannot read property 'props' of undefined" error occurs when a class method is called without having the correct context bound to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s a workaround: disable the no-useless-rename rule. From my package.json:
Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.
Thanks for contributing to ESLint and we appreciate your understanding.