Skip to content

Design Meeting Notes, 5/21/2020 #38713

Closed
Closed

Description

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

Activity

  1. IgorMinar commented on May 22, 2020

    @IgorMinar

    Daniel Rosenwasser (@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)

  2. jon49 commented on Nov 12, 2020

    @jon49

    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.

  3. mohsen1 commented on Dec 8, 2021

    @mohsen1
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions