Skip to content

Babel with the transform-react-jsx plugin removes parentheses for the cast syntanx of Closure Compiler. (T6918) #3946

@babel-bot

Description

@babel-bot

Issue originally made by @h-maeta

Bug information

  • Babel version: 6.3.26
  • Node version: v0.10.36
  • npm version: v2.5.1

Description

I am using React with Closure Compiler. If you write in JSX the codes with cast like

var foo = /** @type {Foo} */ (this.props.bar);

Babel with the transform-react-jsx plugin converts it to the code:

var foo = /** @type {Foo} */ this.props.bar;

The parentheses around this.props.bar are removed.

As the result, compiling the output js with Closure Compiler always fails by missing parentheses around the cast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions