flowts icon indicating copy to clipboard operation
flowts copied to clipboard

Recast pointlessly strips parenthesis from default exports and then fails validation

Open nickretallack opened this issue 6 years ago • 0 comments

I'm pretty sure it didn't do this in the previous version of flowts. This issue was just introduced. Now, when I put in this input, it produces output that fails the validation because it removed some parenthesis. It doesn't actually matter, but it is a needless change.

Input:

// @flow
export default (function () {});

Output is the same regardless of the --no-prettier flag:

export default function () {}

Console:

verification failed, diff after stripping type annotations:
- Expected
+ Received

- export default (function () {});
+ export default function () {}

When I run it with --no-recast it produces this and doesn't fail validation:

export default (function () {});

nickretallack avatar Apr 10 '20 23:04 nickretallack