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 * as default from "module" syntax should work as per ECMA-262 #39769

Closed
HughCrail opened this issue Jul 27, 2020 · 3 comments · Fixed by #39803
Closed

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

HughCrail opened this issue Jul 27, 2020 · 3 comments · Fixed by #39803
Assignees
Labels
Bug A bug in TypeScript Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". ES Next New featurers for ECMAScript (a.k.a. ESNext) Fix Available A PR has been opened for this issue Help Wanted You can do this

Comments

@HughCrail
Copy link

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

@DanielRosenwasser DanielRosenwasser added ES Next New featurers for ECMAScript (a.k.a. ESNext) Suggestion An idea for TypeScript labels Jul 27, 2020
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.1.0 milestone Jul 27, 2020
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript and removed Suggestion An idea for TypeScript labels Jul 27, 2020
@DanielRosenwasser DanielRosenwasser added Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this labels Jul 27, 2020
@DanielRosenwasser
Copy link
Member

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

@Kingwl
Copy link
Contributor

Kingwl commented Jul 29, 2020

Take a look soon.

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jul 29, 2020
@DanielRosenwasser
Copy link
Member

Thanks @Kingwl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". ES Next New featurers for ECMAScript (a.k.a. ESNext) Fix Available A PR has been opened for this issue Help Wanted You can do this
5 participants