-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
The tsc.js should not suppress const enums, otherwise enums like ModuleKind and SyntaxKind are not present in the generated JavaScript. As a result, compiler wrappers, etc. not written in TypeScript cannot use those enums and must resort to hard-coding their values in their source.
Code that worked before:
this._options = {
module: ts.ModuleKind.None,
out: "output.js",
...must now be written like this:
this._options = {
module: 0 /* ts.ModuleKind.None */,
out: "output.js",
...Only wrappers themselves written in TypeScript will not have a problem, since the compiler will do this transformation for them.
I understand that you may not want to disable this optimization for tsc.js itself. If the intent is to have a separate file to export the API (#372) instead of exporting it from tsc.js, then that file should be compiled with preserveConstEnums on.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript