lyft/react-javascript-to-typescript-transform

Unable to convert some files

akx opened this issue · 3 comments

akx commented

The files https://github.com/kcsry/infotv/blob/68963e5161a811fb0edf10584e7e12466ef470a8/infotv/frontend/src/s/text-slide.jsx and https://github.com/kcsry/infotv/blob/68963e5161a811fb0edf10584e7e12466ef470a8/infotv/frontend/src/s/image-slide.jsx do not convert, unless the propTypes blocks are removed.

The traceback is

TypeError: Cannot read property 'text' of undefined
    at IdentifierObject.TokenOrIdentifierObject.getText (~/node_modules/typescript/lib/typescript.js:100312:31)
    at ~/dist/transforms/react-stateless-function-make-props-transform.js:64:86
    at baseFindIndex (~/node_modules/lodash/lodash.js:823:11)
    at findIndex (~/node_modules/lodash/lodash.js:7275:14)
    at Function.find (~/node_modules/lodash/lodash.js:5098:21)
    at _loop_1 (~/dist/transforms/react-stateless-function-make-props-transform.js:62:31)
    at visitSourceFile (~/dist/transforms/react-stateless-function-make-props-transform.js:73:13)
    at reactStatelessFunctionMakePropsTransform (~/dist/transforms/react-stateless-function-make-props-transform.js:47:27)
    at ~/node_modules/typescript/lib/typescript.js:2888:86
    at reduceLeft (~/node_modules/typescript/lib/typescript.js:2581:30)
    at ~/node_modules/typescript/lib/typescript.js:2888:42
    at Object.map (~/node_modules/typescript/lib/typescript.js:1879:29)
    at Object.transformNodes (~/node_modules/typescript/lib/typescript.js:67699:30)
    at Object.transform (~/node_modules/typescript/lib/typescript.js:102568:25)
    at Object.compile (~/dist/compiler.js:41:21)
    at Object.run (~/dist/index.js:35:23)

Probably related to microsoft/TypeScript#24273

I noticed that all files giving this error to me had more than one component on them.
Files with only one component worked fine.

Thank you for you contribution to this repository.

Closing this contribution as this repository is being archived.