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

Design Meeting Notes, 5/21/2020 #38713

Closed
DanielRosenwasser opened this issue May 21, 2020 · 3 comments
Closed

Design Meeting Notes, 5/21/2020 #38713

DanielRosenwasser opened this issue May 21, 2020 · 3 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

Always Emit export {}

#38696

  • What does "always" mean?
  • If there were import/export statements in the file, there must at least be one import or export in the output.
  • We already have this rule in declaration files.
    • We just don't do it in module output.
    • We probably do.
  • This is valuable for tools like Webpack/TypeScript, but there's a class of users who won't want this.
    • They will have a point.
  • Conclusion

Optimization hints on classes

#38602
#38566

In 3.9 we started emitting an IIFE around classes with statics when targeting ES2015.

class C {
    static x = someExpression();
}

Becomes

let C = /** @class */ (() => {
    class C {
    }
    C.x = someExpression();
});

Closure can't understand this output.

https://www.hyrumslaw.com/

Allow modules to implement interfaces

#420

@IgorMinar
Copy link

@DanielRosenwasser I'm happy to talk to any of you about the class emit shape and #32011 - I think the wrapping is the right behavior at the moment. See #38374 (comment)

@jon49
Copy link

jon49 commented Nov 12, 2020

So, for those of us that don't want or need this behavior. What is the work around? This should be done explicitly by the user if they want to export export {}. This breaks my code for service workers when I'm importing only types.

@mohsen1
Copy link
Contributor

mohsen1 commented Dec 8, 2021

RE: Allow modules to implement interfaces

export implements seems like the most natural syntax to me. Compared to module implements at least. module has a few meanings in TypeScript world.

One of the biggest wins is Next.js and other similar frameworks that expect a file to export specifically named functions for various things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Notes Notes from our design meetings
Projects
None yet
Development

No branches or pull requests

5 participants