lyft/react-javascript-to-typescript-transform

Named-function SFCs get mistransformed

akx opened this issue · 1 comments

akx commented

I have an SFC written as a named function, so it can be default-exported with the name intact:

export default function PopoverConfirmedButton({...}) { ... }

This gets transformed into

export default const PopoverConfirmedButton: React.SFC<PopoverConfirmedButtonProps> = ({...}) { ... }

which is not a valid ES export statement, so the Prettier step chokes and I get Failed to convert js/components/PopoverConfirmedButton.jsx.

The correct transformation would probably be

const PopoverConfirmedButton: React.SFC<PopoverConfirmedButtonProps> = ({...}) { ... }
export default PopoverConfirmedButton;

Thank you for you contribution to this repository.

Closing this contribution as this repository is being archived.