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

Emit a better warning when default-exporting an inappropriate declaration #3917

Closed
DanielRosenwasser opened this issue Jul 17, 2015 · 4 comments
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Milestone

Comments

@DanielRosenwasser
Copy link
Member

Courtesy of @LPGhatguy in #3914.

Instead of going off the rails, we should resiliently parse the following:

export default interface User {
    hi: string;
}

And give an error like

An 'interface' declaration cannot be 'export default'. Consider writing 'export default User;' separately.
@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Jul 17, 2015
@danquirk
Copy link
Member

If we don't fix #3914 we should certainly do this. My preference would be to just allow these sorts of declarations.

@DanielRosenwasser
Copy link
Member Author

Agreed, I'd prefer just allowing these sorts of declarations for the sake of consistency.

@mhegazy mhegazy added this to the Community milestone Aug 11, 2015
@mhegazy mhegazy added the Help Wanted You can do this label Aug 11, 2015
@DanielRosenwasser DanielRosenwasser added the Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". label Sep 29, 2015
@clavecoder
Copy link

clavecoder commented Jul 3, 2016

I'm guessing it's not allowed because interfaces and enums are not EcmaScript objects, correct? What's the list of types this fails on? Just interface and enum or are there more?

@Kingwl
Copy link
Contributor

Kingwl commented May 15, 2019

seems already worked?

@DanielRosenwasser DanielRosenwasser added Fixed A PR has been merged for this issue Suggestion An idea for TypeScript and removed Bug A bug in TypeScript Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this labels May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

6 participants