Skip to content

Add ScriptTarget.ES6 #595

Closed
Closed

Description

@duncanmak

There's been multiple issues raised regarding having more ES6 features in Typescript (#7, #13, #19, #232, #237, #240, #389, etc). I'm personally interested in implementing #13.

Would it help to add ES6 to the ScriptTarget enum and begin implementing parser changes to allow the new syntax under the new language level?

Once we allow the new syntax, we can first begin by passing through the code directly (since the generated code is ES6). Later on, we can handle code generation for other targets.

This could also affect existing features in Typescript that have ES6 equivalents - for example, rest parameters in function declarations can be emitted as is in ES6 using the spread operator, without generating the code to splice out arguments.

Activity

  1. vvakame commented on Sep 5, 2014

    @vvakame
    Contributor
  2. duncanmak commented on Sep 12, 2014

    @duncanmak
    Author

    jonathandturner - I saw that you mentioned in #670 that there are plans for adding ES6 to Typescript.

    I'm interested in working on template strings, what's the best way for me to contribute?

  3. mhegazy commented on Sep 13, 2014

    @mhegazy
    Contributor

    thanks Duncan Mak (@duncanmak), we have a separate bug tracking this (#13).

    We will want to support this for down-level first, translating the template into regular strings with plus between parts. later on when we support emitting in ES6, the translation would be trivial.

    As for contributing, PR's would be the best approach. Since this is a bigger change than normal bug fixes, please share your changes early and incrementally so that we can provide feedback.

    I would start by parsing, and adding tests for these cases, then add emit, and finally wire the type checking in.

    Feel free to tag me, or email me directly if you have any questions.

  4. seanhess commented on Sep 16, 2014

    @seanhess

    👍 It will take much more time to support fancy ES6 features in ES5 than it will to just pass them through and make sure type checking works. I'm super conflicted because node supports generators but TS doesn't.

  5. mhegazy commented on Oct 25, 2014

    @mhegazy
    Contributor

    Target added in #904, along withn Let and Const support. emitting other ES6 compliant structures (e.g. classes, arrow functions, rest args, etc..) to ES6 will occur incrementally as we go

  6. locked and limited conversation to collaborators on Jun 18, 2018
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

    ES6Relates to the ES6 Spec

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions