question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'type' of undefined (destructuring props)

See original GitHub issue
const 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:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sackeyjasoncommented, Sep 30, 2019

Here’s a workaround: disable the no-useless-rename rule. From my package.json:

"no-useless-rename": [
  "error",
    {
      "ignoreDestructuring": true
    }
  ]
0reactions
eslint-deprecated[bot]commented, Nov 1, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found