Skip to content

[Bug]: Misparsed Flow comment type annotation with a nested comment #15061

@thorn0

Description

@thorn0

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

const c = (data/*: /* this is an object *-/ Object */) => {};

Configuration file name

No response

Configuration

{ "plugins": ["flow", "flowComments"] }

Current and expected behavior

See https://astexplorer.net/#/gist/5fdbbaf16abcc351777e4f63b57b2e77/c87709ee4645b1d55d9eb27c83077698ffff7a9d

  • The id in the type annotation is parsed to be bject instead of expected Object.
  • The nested comment isn't included in the AST.

Environment

Babel 7.18.0 (AST explorer), 7.19.3 (locally)

Possible solution

No response

Additional context

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions