Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export interface not supported in Flow #494

Open
coaxial opened this issue Apr 10, 2018 · 1 comment
Open

export interface not supported in Flow #494

coaxial opened this issue Apr 10, 2018 · 1 comment

Comments

@coaxial
Copy link
Contributor

coaxial commented Apr 10, 2018

Flow supports export interface, but importjs doesn't pick up on these statements when auto-importing.

A workaround is to use the same workaround as for older Flow versions:

interface iMyInterface { ... }
export type IMyInterface = iMyInterface

It would be nice if import-js supported the shorter export interface... syntax since Flow now supports it.

cf. facebook/flow#1131

@lencioni
Copy link
Collaborator

@coaxial I'd be happy to review a pull request that adds this feature and tests. I think you'd probably need to modify something around this area:

function findFlowTypeExports(node) {
if (node.type !== 'ExportNamedDeclaration') {
return [];
}
if (!node.declaration) {
return [];
}
if (node.declaration.type === 'TypeAlias') {
return [node.declaration.id.name];
}
return [];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants