Skip to content

[compiler] Flow type annotations triggering stdlib imports. #36

@wcjohnson

Description

@wcjohnson

On [email protected]:

          import type Foo from 'foo';
          import type Foo2 from 'foo';
          import type Foo3 from 'foo';
          var a: {add(x:Foo, ...y:Array<Foo2>): Foo3}; a;
import add from 'lodash/add';
import type Foo from 'foo';
import type Foo2 from 'foo';
import type Foo3 from 'foo';
var a: { add: (x: Foo, ...y: Array<Foo2>) => Foo3 };a;

The add identifier inside of the Flow type annotation on line 4 is apparently being treated as a ReferencedIdentifier and therefore triggering the lodash import. This definitely shouldn't be the case.

I don't have a suggested resolution at the moment as I haven't been able to figure it out myself. This may actually be a Babel bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions