Skip to content

suggestion to inline const keywords for ES5 #3964

@Gambero81

Description

@Gambero81

it would be great to transpile const declaration with inline value when target is ES5 (as already Done with const enum), so it will prevent to include useless javascript.
An example:

const A = "myConstValue";
alert(A);
// generated js code:
alert("myConstValue" /* A */)

Another example:
module MyConstMudule
{
   export const A = "myConstValue";
}
alert(MyConstModule.A);
// generate js code:
alert("myConstValue" /* MyConstModule.A */);

what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Out of ScopeThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions