Skip to content

export * as default from "module" syntax should work as per ECMA-262 #39769

Closed

Description

@HughCrail

TypeScript Version: 4.0.0-beta

Search Terms:
ESModule, export star as default, "export * as default from"

Expected behavior:
export * as default from "module" should export the namespace of "module" as the default export.
This is valid ES Module syntax from this stage-4 proposal. See the test in test-262.
I also tested this syntax in Chrome and it was supported.

Actual behavior:
You get the following errors:

  • "Cannot find name 'from'."
  • "Identifier expected. 'default' is a reserved word that cannot be used here."
  • "';' expected."

Code

export * as default from "rollup";
Output
export * as  from ;
from;
"rollup";
Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": 2,
    "target": "Latest",
    "jsx": "React",
    "module": "ESNext"
  }
}

Playground Link: Provided

Activity

  1. added
    ES Next
    Suggestion
    on Jul 27, 2020
  2. added
    Bug
    and removed
    Suggestion
    on Jul 27, 2020
  3. added
    Effort: Moderate
    on Jul 27, 2020
  4. DanielRosenwasser commented on Jul 27, 2020

    @DanielRosenwasser
    Member

    CC Wenlu Wang (@Kingwl) in case you want to take this on as a follow-up to #34903

  5. Kingwl commented on Jul 29, 2020

    @Kingwl
    Contributor

    Take a look soon.

  6. added
    Fix Available
    on Jul 29, 2020
  7. DanielRosenwasser commented on Aug 10, 2020

    @DanielRosenwasser
    Member
  8. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugES NextEffort: ModerateFix Available

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ Proxy