Flow: Support additional export-from statement proposal

Created on 13 Oct 2015  路  22Comments  路  Source: facebook/flow

A.js:

export default 5;

B.js:

export a from './A';

Unexpected identifier error:

src/B.js:2
  2: export a from './A';
            ^ Unexpected identifier

Flow 0.17

ES2015+ parsing

Most helpful comment

@rohmanhm https://github.com/facebook/flow/issues/916#issuecomment-179849998 does not solve

export a from './A';

All 22 comments

Is this syntax valid ES2015? I'm not seeing a production in the spec for this. The only production that has a _FromClause_ doesn't appear to permit a simple identifier as the _ExportClause_.

Do you have existing code that uses this syntax? How is it compiled?

OK, so this seems to be a ES2016 proposed syntax from Facebook's own @leebyron. I don't think Flow has an established rule about what stage proposals we'll implement, but stage 1 seems a bit early to me. Looks like this one might hit stage 2 soon. I imagine this feature will have plenty of support internally to push it through :-)

This is the same issue as #916. Linking the issues so we can close them all when a fix lands.

How is the state of that issue ?

Still fails on v0.33.0

+1

:+1:

+1

+1

the same still happens on 0.44

@sibelius please take a look this comment https://github.com/facebook/flow/issues/916#issuecomment-179849998

@rohmanhm https://github.com/facebook/flow/issues/916#issuecomment-179849998 does not solve

export a from './A';

the same on 0.53

Anybody faces the issue where suppress comments don't work for this case?

What is the error you're seeing that suppress comments aren't preventing? Is the error getting attached to a different line in the source?

@asolove The flow error related to transform-export-extensions not being fully supported yet, it's the same line.
screen shot 2017-08-31 at 3 03 59 am

Error: src/configs/lib.js:42
 43: export axios from 'axios';
            ^^^^^ Unexpected identifier

and of course suppress_comment=\\(.\\|\n\\)*\\flow-disable-next-line.

You can't suppress parsing errors

@vkurchatkin Got it, we wait till support for it lands then.

Same for 0.58.0

This is a completely acceptable workaround:

export { default as a } from './a';

can we add an option for this

https://github.com/facebook/flow/issues/916#issuecomment-310114962

much like

esproposal.export_star_as=enabled ?

Same for 0.68.0

Was this page helpful?
0 / 5 - 0 ratings