Skip to content

import/named doesn't detect Flow Opaque types in flow comments #921

@johnhaley81

Description

@johnhaley81

Hi all!

When using flow opaque types (new in https://github.com/facebook/flow/releases/tag/v0.51.0) via flow comments The import/named rule doesn't detect the exported types.

Ex:

Foo.js

// @flow

/*::
export opaque type Foo = string;
*/

export const makeFoo = (): Foo => 'new foo';

UseFoo.js

// @flow

import { type Foo } from './Foo'; // Foo not found in './Foo' (import/named)

A weird workaround is to remove makeFoo from Foo.js and that will fix the linter rule. Don't know why that is. It's also not a good workaround since that makes the opaque type useless.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions