Skip to content

flow-remove-types throws a syntax error on ES import attributes #9347

@sangafabrice

Description

@sangafabrice

flow-remove-types version: 2.295.0
Flow version: 0.295.0

Actual behavior

The Flow parser successfully parses the following script without any errors:

/** @flow @file index.js */
import ruleset from "./htmlhint.json" with { type: "json" };

However, running flow-remove-types on the same file results in a syntax error:

$ npx flow-remove-types --out-file .\index.out.js .\index.js
.\index.js
 ↳ Syntax Error: ';' expected (2:38)
import ruleset from "./htmlhint.json" with { type: "json" };
                                      ^
   1:  import ruleset from "./htmlhint.json" with { type: "json" };

Expected behavior

The command should complete successfully and generate the output file without throwing an error:

$ npx flow-remove-types --out-file .\index.out.js .\index.js
.\index.js
 ↳ .\index.out.js
  • Link to Try-Flow or Github repo: N/A (The issue is specific to flow-remove-types and does not require Flow server execution or .flowconfig settings.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions