Skip to content

Comment types of Flow makes Prettier confused #5446

Description

@jinmayamashita

Prettier 1.15.1

Sorry, I could not reproduce it on v1.15.2 playground. 🙇 (solved at 1.15.2 ? 👀)
Playground link

In flow, I can typecast with the following, not type-assertion.

Input:

type Props = {|
  ...$Exact<PropsWithTFn>,
  ...$Exact<$Call<typeof mapStateToProps, *, *>>,
  ...$Exact<$Call<typeof mapDispatch, *, *>>,
  ...$Exact<withResponse.WithQueryProps<RootQuery>>,
|};

However, this gets error message below in prettier 1.15.1

Replace `<$Call<typeof·mapDispatch,·**>>` with `/*::·<$Call/*::·<typeof·mapDispatch,·**>·*/>·*/`

Output:

type Props = {|
  ...$Exact<PropsWithTFn>,
  ...$Exact/*:: <$Call/*:: <typeof·mapStateToProps, *, *>*/> */
  ...$Exact/*:: <$Call/*:: <typeof mapDispatch, *, *>*/> */,
  ...$Exact/*:: <withResponse.WithQueryProps<RootQuery>*/> */,
|};

Expected behavior:

type Props = {|
  ...$Exact<PropsWithTFn>,
  ...$Exact<$Call<typeof mapStateToProps, *, *>>,
  ...$Exact<$Call<typeof mapDispatch, *, *>>,
  ...$Exact<withResponse.WithQueryProps<RootQuery>>,
|};

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:flow comment typeslang:flowIssues affecting Flow-specific constructs (not general JS issues)priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions