babel-plugin-react-transform icon indicating copy to clipboard operation
babel-plugin-react-transform copied to clipboard

Guard access to node.key when finding displayName

Open stephen opened this issue 9 years ago • 0 comments

This PR addresses an issue where use of the spread operator inside of a component spec causes getDisplayName to fail, since SpreadOperator nodes don't have a key property.

Example class:

const definition = {};
React.createClass({
  ...definition,
  displayName: 'TestClass',
});

Error output:

TypeError: Cannot read property 'name' of undefined while parsing file: <file>

stephen avatar Jun 22 '16 18:06 stephen