Open
Description
When running the pure-component codemod on a typescript file
// TransformTest.tsx
import React from 'react';
class TransformTest extends React.Component {
render() {
return <div>I've too much class</div>;
}
}
export default TransformTest;
I see the following errors
react-codemod pure-component TransformTest.tsx
? Which dialect of JavaScript do you use? TypeScript
? Use arrow functions? No
? Destructure props? No
Executing command: jscodeshift --verbose=2 --ignore-pattern=**/node_modules/** --parser tsx --extensions=tsx,ts,jsx,js --transform /Users/nick/.config/yarn/global/node_modules/react-codemod/transforms/pure-component.js TransformTest.tsx
Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
ERR TransformTest.tsx Transformation error (Cannot read property 'value' of undefined)
TypeError: Cannot read property 'value' of undefined
at NodePath.pureClasses.replaceWith.p (/Users/nick/.config/yarn/global/node_modules/react-codemod/transforms/pure-component.js:296:37)
at NodePath.<anonymous> (/Users/nick/.config/yarn/global/node_modules/react-codemod/node_modules/jscodeshift/src/collections/Node.js:144:47)
at __paths.forEach (/Users/nick/.config/yarn/global/node_modules/react-codemod/node_modules/jscodeshift/src/Collection.js:77:36)
at Array.forEach (<anonymous>)
at Collection.forEach (/Users/nick/.config/yarn/global/node_modules/react-codemod/node_modules/jscodeshift/src/Collection.js:76:18)
at Collection.replaceWith (/Users/nick/.config/yarn/global/node_modules/react-codemod/node_modules/jscodeshift/src/collections/Node.js:142:17)
at Collection.replaceWith (/Users/nick/.config/yarn/global/node_modules/react-codemod/node_modules/jscodeshift/src/Collection.js:415:43)
at module.exports (/Users/nick/.config/yarn/global/node_modules/react-codemod/transforms/pure-component.js:291:15)
All done.
Results:
1 errors
0 unmodified
0 skipped
0 ok
Node v10.18.0
Metadata
Metadata
Assignees
Labels
No labels