mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:51:43 -06:00
Do not emit __extends if --noEmitHelpers is set
This commit is contained in:
parent
93bf569432
commit
101aedbf4e
@ -5487,9 +5487,6 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
|
||||
}
|
||||
|
||||
write("[\"require\", \"exports\"");
|
||||
if (compilerOptions.noEmitHelpers) {
|
||||
write(", \"__extends\"");
|
||||
}
|
||||
if (aliasedModuleNames.length) {
|
||||
write(", ");
|
||||
write(aliasedModuleNames.join(", "));
|
||||
@ -5499,9 +5496,6 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
|
||||
write(unaliasedModuleNames.join(", "));
|
||||
}
|
||||
write("], function (require, exports");
|
||||
if (compilerOptions.noEmitHelpers) {
|
||||
write(", __extends");
|
||||
}
|
||||
if (importAliasNames.length) {
|
||||
write(", ");
|
||||
write(importAliasNames.join(", "));
|
||||
@ -5623,7 +5617,6 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
|
||||
|
||||
// Only emit helpers if the user did not say otherwise.
|
||||
if (!compilerOptions.noEmitHelpers) {
|
||||
|
||||
// Only Emit __extends function when target ES5.
|
||||
// For target ES6 and above, we can emit classDeclaration as is.
|
||||
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends)) {
|
||||
@ -5643,7 +5636,6 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
|
||||
writeLines(paramHelper);
|
||||
paramEmitted = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isExternalModule(node) || compilerOptions.separateCompilation) {
|
||||
|
||||
17
tests/baselines/reference/noEmitHelpers2.js
Normal file
17
tests/baselines/reference/noEmitHelpers2.js
Normal file
@ -0,0 +1,17 @@
|
||||
//// [noEmitHelpers2.ts]
|
||||
|
||||
function decorator() { }
|
||||
|
||||
@decorator
|
||||
class A { }
|
||||
|
||||
//// [noEmitHelpers2.js]
|
||||
function decorator() { }
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A = __decorate([
|
||||
decorator
|
||||
], A);
|
||||
return A;
|
||||
})();
|
||||
10
tests/cases/compiler/noEmitHelpers2.ts
Normal file
10
tests/cases/compiler/noEmitHelpers2.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// @noemithelpers: true
|
||||
// @target: es5
|
||||
|
||||
function decorator() { }
|
||||
|
||||
@decorator
|
||||
class A {
|
||||
constructor(a: number, b: string) {
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user