-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Support ES export * as ns from
form
#4813
Comments
export form
formsexport form
forms
export form
formsexport from
forms
👍 |
export from
formsexport from
forms
export from
formsexport from
forms
This would be incredibly helpful for supporting intellisense for JavaScript projects in VS Code; |
At first I thought this (the ECMAScript proposal) was a bad idea because the preponderance of existing export forms is a source of confusion for newcomers. However, I've come around to the idea that the asymmetry between the import and export forms is actually a source of confusion in itself so adding this would be beneficial. |
Is there any chance of this being added sometime soon? I've been using this feature in my codebase with the |
Our team's projects usually has a import {
React,
PropTypes,
PureComponent,
Button,
connect,
} from './common' Without // This ...
export React, {
PureComponent,
PropTypes,
} from 'react'
// ... becomes ...
import * as _React from 'react'
export const React = _React
export const PropTypes = _React.PropTypes
export const PureComponent = _React.PureComponent |
Even more strange that |
You can do:
export { default as React, PureComponent, PropTypes, } from 'react'
…On Wed, May 10, 2017, 11:32 mikew ***@***.***> wrote:
Even more strange that export { connect } from 'react-redux' works.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4813 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAChnZzvzQc10WXj9VkLM1HGl7B_D5Ulks5r4gLCgaJpZM4F-BqL>
.
|
Almost, except then it's |
@mikew That is true but the same issue would apply to the proposed export React, {
PureComponent,
PropTypes,
} from 'react'; The However, it is entirely orthogonal to this proposal. If you can write import React from 'react'; and it works at runtime, set the |
#9906 tracked the proposed Adding this comment to make sure the request for supporting |
import * as ns from "foo";
export { ns } and feed down the transformer pipeline). This does imply a new module target that doesn't downlevel it, though, which means a bump of the cc @RyanCavanaugh so we're aware |
It probably should be preserved instead of downleveled in Tangentially, this syntax is useful because of a bug in webpack 4 (fixed in webpack 5). It treats |
export from
formsexport * as ns from
form
Changed the title since there is currently no export default version of this. |
It's still mis-titled because it's no longer "proposed"; it is already in the spec 😉 |
export * as ns from
formexport * as ns from
form
I’ve now opened #35010 for the |
Thanks @Kingwl! |
Previously I liked using TS namespaces and declaration merging for creating FP-style modules, without needing the export type Foobar = { }
export namespace Foobar {
export function doStuff(foobar: Foobar) { }
} import { Foobar } from './Foobar'
Foobar.doStuff(fb) Namespaces are not really the way to go any more, babel doesn't support them, they probably aren't tree-shakeable etc. But I was hoping that the export type Foobar = import('./Foobar').Foobar
// Or:
// export type { Foobar } from './Foobar'
export * as Foobar from './Foobar' This seems to pass the nightly compiler, but the compiler only knows that Foobar is re-exported as a type, not a value. It would be great if the compiler could merge them into a combined value & type like with namespaces. |
The ES7 proposal is available at: https://github.com/leebyron/ecmascript-more-export-from
The additions include:
reexporting default:
reexporting as sub-module:
also allowing combining
The text was updated successfully, but these errors were encountered: