mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Retain undefined initializations (#36806)
* Emit an export assignment even when the initializer is elided * User a void 0; and elide assignments for enum/namespace-sourced exported variables * HAHA, SIMPLIFY GREATLY
This commit is contained in:
1 parent
56b6d0d666
commit
454cdb8279
77 files changed
+226
-15
No files matched your search
@@ -1180,7 +1180,6 @@ namespace ts {
|
||||
let modifiers: NodeArray<Modifier> | undefined;
|
||||
|
||||
// If we're exporting these variables, then these just become assignments to 'exports.x'.
|
||||
// We only want to emit assignments for variables with initializers.
|
||||
for (const variable of node.declarationList.declarations) {
|
||||
if (isIdentifier(variable.name) && isLocalName(variable.name)) {
|
||||
if (!modifiers) {
|
||||
@@ -1189,7 +1188,7 @@ namespace ts {
|
||||
|
||||
variables = append(variables, variable);
|
||||
}
|
||||
else if (variable.initializer) {
|
||||
else {
|
||||
expressions = append(expressions, transformInitializedVariable(variable));
|
||||
}
|
||||
}
|
||||
@@ -1259,7 +1258,7 @@ namespace ts {
|
||||
),
|
||||
/*location*/ node.name
|
||||
),
|
||||
visitNode(node.initializer, moduleExpressionElementVisitor)
|
||||
node.initializer ? visitNode(node.initializer, moduleExpressionElementVisitor) : createVoidZero()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export var a = function () {
|
||||
//// [aliasUsedAsNameValue_0.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.id = void 0;
|
||||
//// [aliasUsedAsNameValue_1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
|
||||
@@ -18,6 +18,7 @@ export class Test1 {
|
||||
//// [classMemberInitializerWithLamdaScoping3_0.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.field1 = void 0;
|
||||
//// [classMemberInitializerWithLamdaScoping3_1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
|
||||
@@ -7,4 +7,6 @@ export var b: number;
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/** b's comment*/
|
||||
exports.b = void 0;
|
||||
});
|
||||
@@ -21,6 +21,7 @@ export var x: SubModule.m.m3.c;
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
|
||||
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts]
|
||||
|
||||
@@ -20,6 +20,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
exports.x.a;
|
||||
});
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ define(["require", "exports", "declFileExportImportChain_b1"], function (require
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ define(["require", "exports", "declFileExportImportChain2_b"], function (require
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ var z = b.x;
|
||||
//// [declFileForExportedImport_0.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
//// [declFileForExportedImport_1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
|
||||
@@ -89,6 +89,7 @@ var C;
|
||||
}());
|
||||
C.D = D;
|
||||
})(C = exports.C || (exports.C = {}));
|
||||
exports.a = void 0;
|
||||
exports.b = C.F;
|
||||
exports.c = C.F2;
|
||||
exports.d = C.F3;
|
||||
|
||||
@@ -12,6 +12,7 @@ declare function dec<T>(target: T): T;
|
||||
//// [decoratorOnImportEquals2_0.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.X = void 0;
|
||||
//// [decoratorOnImportEquals2_1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -29,6 +29,7 @@ export { exportedFoo as foo, nonexportedFoo as nfoo };
|
||||
"use strict";
|
||||
var _a, _b, _c, _d, _e;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.exportedFoo = void 0;
|
||||
exports.foo = exports.exportedFoo;
|
||||
let nonexportedFoo;
|
||||
exports.nonexportedFoo = nonexportedFoo;
|
||||
|
||||
@@ -6,5 +6,6 @@ import("./a");
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
exports.x = void 0;
|
||||
Promise.resolve().then(function () { return require("./a"); });
|
||||
module.exports = exports.x;
|
||||
@@ -81,6 +81,7 @@ var c = { a: { x: 'hello', y: 2 } }; // error - y does not exist in type A
|
||||
var d = { a: { x: 'hello' }, c: 5 }; // ok
|
||||
var e = { a: { x: 2 }, c: 5 }; // error - types of property x are incompatible
|
||||
var f = { a: { x: 'hello', y: 2 }, c: 5 }; // error - y does not exist in type A
|
||||
exports.obj = void 0;
|
||||
exports.photo = {
|
||||
id: 1,
|
||||
url: '',
|
||||
|
||||
@@ -40,11 +40,17 @@ define(["require", "exports"], function (require, exports) {
|
||||
var ;
|
||||
let;
|
||||
var ;
|
||||
exports.a = void 0;
|
||||
exports.b = void 0;
|
||||
exports.c = void 0;
|
||||
exports.d = void 0;
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.e = void 0;
|
||||
exports.f = void 0;
|
||||
var B;
|
||||
(function (B) {
|
||||
B.a = 1, B.c = 2;
|
||||
|
||||
@@ -39,11 +39,17 @@ exports.__esModule = true;
|
||||
var ;
|
||||
let;
|
||||
var ;
|
||||
exports.a = void 0;
|
||||
exports.b = void 0;
|
||||
exports.c = void 0;
|
||||
exports.d = void 0;
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.e = void 0;
|
||||
exports.f = void 0;
|
||||
var B;
|
||||
(function (B) {
|
||||
B.a = 1, B.c = 2;
|
||||
|
||||
@@ -48,11 +48,17 @@ export let h1: D = new D;
|
||||
var ;
|
||||
let;
|
||||
var ;
|
||||
exports.a = void 0;
|
||||
exports.b = void 0;
|
||||
exports.c = void 0;
|
||||
exports.d = void 0;
|
||||
var A = /** @class */ (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.e = void 0;
|
||||
exports.f = void 0;
|
||||
var B;
|
||||
(function (B) {
|
||||
B.a = 1, B.c = 2;
|
||||
|
||||
@@ -16,4 +16,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
});
|
||||
@@ -901,6 +901,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
})(eM = M_1.eM || (M_1.eM = {}));
|
||||
;
|
||||
})(M || (M = {}));
|
||||
exports.eV = void 0;
|
||||
function eF() { }
|
||||
exports.eF = eF;
|
||||
;
|
||||
|
||||
@@ -90,6 +90,7 @@ var d = /** @class */ (function () {
|
||||
return d;
|
||||
}());
|
||||
exports.d = d;
|
||||
exports.x = void 0;
|
||||
function foo() { return null; }
|
||||
exports.foo = foo;
|
||||
//// [importDecl_require1.js]
|
||||
@@ -113,6 +114,7 @@ var d = /** @class */ (function () {
|
||||
return d;
|
||||
}());
|
||||
exports.d = d;
|
||||
exports.x = void 0;
|
||||
function foo() { return null; }
|
||||
exports.foo = foo;
|
||||
//// [importDecl_require3.js]
|
||||
@@ -124,6 +126,7 @@ var d = /** @class */ (function () {
|
||||
return d;
|
||||
}());
|
||||
exports.d = d;
|
||||
exports.x = void 0;
|
||||
function foo() { return null; }
|
||||
exports.foo = foo;
|
||||
//// [importDecl_require4.js]
|
||||
|
||||
@@ -23,6 +23,7 @@ exports.B = B;
|
||||
//// [importDeclarationUsedAsTypeQuery_1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
|
||||
|
||||
//// [importDeclarationUsedAsTypeQuery_require.d.ts]
|
||||
|
||||
@@ -11,6 +11,7 @@ export var x: b;
|
||||
//// [internalAliasInterfaceInsideTopLevelModuleWithExport.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
|
||||
|
||||
//// [internalAliasInterfaceInsideTopLevelModuleWithExport.d.ts]
|
||||
|
||||
@@ -12,6 +12,7 @@ export var x: b;
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
+1
@@ -24,4 +24,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
(function (c) {
|
||||
c.x.foo();
|
||||
})(c = exports.c || (exports.c = {}));
|
||||
exports.z = void 0;
|
||||
});
|
||||
+1
@@ -16,6 +16,7 @@ x.foo();
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
exports.x.foo();
|
||||
});
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ x.foo();
|
||||
//// [internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
exports.x.foo();
|
||||
|
||||
|
||||
|
||||
@@ -4,3 +4,4 @@ export var x;
|
||||
//// [file1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
@@ -4,3 +4,4 @@ export var x;
|
||||
//// [file1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
@@ -18,6 +18,7 @@ fn(a); // Error: property 'x' is missing from 'a'
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
});
|
||||
//// [moduleAliasAsFunctionArgument_1.js]
|
||||
define(["require", "exports", "moduleAliasAsFunctionArgument_0"], function (require, exports, a) {
|
||||
|
||||
@@ -15,6 +15,8 @@ var x = 1;
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/// <reference path="ref.ts"/>
|
||||
exports.y = void 0;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -32,6 +32,7 @@ export let y: number;
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0;
|
||||
});
|
||||
//// [file2.js]
|
||||
define(["require", "exports", "module1", "templates/module2", "../file3"], function (require, exports, module1_1, module2_1, file3_1) {
|
||||
|
||||
@@ -31,6 +31,7 @@ export let y: number;
|
||||
//// [module2.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0;
|
||||
//// [file2.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
|
||||
@@ -10,6 +10,7 @@ export var b = foo;
|
||||
exports.__esModule = true;
|
||||
function foo() {
|
||||
}
|
||||
exports.x = void 0;
|
||||
exports.b = foo;
|
||||
|
||||
|
||||
|
||||
@@ -177,9 +177,11 @@ define(["require", "exports"], function (require, exports) {
|
||||
var privateUse_im_public_v_private = exports.im_public_v_private;
|
||||
exports.publicUse_im_public_v_private = exports.im_public_v_private;
|
||||
var privateUse_im_public_i_private;
|
||||
exports.publicUse_im_public_i_private = void 0;
|
||||
var privateUse_im_public_mi_private = new exports.im_public_mi_private.c();
|
||||
exports.publicUse_im_public_mi_private = new exports.im_public_mi_private.c();
|
||||
var privateUse_im_public_mu_private;
|
||||
exports.publicUse_im_public_mu_private = void 0;
|
||||
// No Privacy errors - importing public elements
|
||||
exports.im_public_c_public = m_public.c_public;
|
||||
exports.im_public_e_public = m_public.e_public;
|
||||
@@ -196,9 +198,11 @@ define(["require", "exports"], function (require, exports) {
|
||||
var privateUse_im_public_v_public = exports.im_public_v_public;
|
||||
exports.publicUse_im_public_v_public = exports.im_public_v_public;
|
||||
var privateUse_im_public_i_public;
|
||||
exports.publicUse_im_public_i_public = void 0;
|
||||
var privateUse_im_public_mi_public = new exports.im_public_mi_public.c();
|
||||
exports.publicUse_im_public_mi_public = new exports.im_public_mi_public.c();
|
||||
var privateUse_im_public_mu_public;
|
||||
exports.publicUse_im_public_mu_public = void 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -177,9 +177,11 @@ define(["require", "exports"], function (require, exports) {
|
||||
var privateUse_im_private_v_private = im_private_v_private;
|
||||
exports.publicUse_im_private_v_private = im_private_v_private;
|
||||
var privateUse_im_private_i_private;
|
||||
exports.publicUse_im_private_i_private = void 0;
|
||||
var privateUse_im_private_mi_private = new im_private_mi_private.c();
|
||||
exports.publicUse_im_private_mi_private = new im_private_mi_private.c();
|
||||
var privateUse_im_private_mu_private;
|
||||
exports.publicUse_im_private_mu_private = void 0;
|
||||
// No Privacy errors - importing public elements
|
||||
var im_private_c_public = m_public.c_public;
|
||||
var im_private_e_public = m_public.e_public;
|
||||
@@ -196,9 +198,11 @@ define(["require", "exports"], function (require, exports) {
|
||||
var privateUse_im_private_v_public = im_private_v_public;
|
||||
exports.publicUse_im_private_v_public = im_private_v_public;
|
||||
var privateUse_im_private_i_public;
|
||||
exports.publicUse_im_private_i_public = void 0;
|
||||
var privateUse_im_private_mi_public = new im_private_mi_public.c();
|
||||
exports.publicUse_im_private_mi_public = new im_private_mi_public.c();
|
||||
var privateUse_im_private_mu_public;
|
||||
exports.publicUse_im_private_mu_public = void 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -324,7 +324,9 @@ var glo_C4_public = /** @class */ (function () {
|
||||
return glo_C4_public;
|
||||
}());
|
||||
var glo_v1_private;
|
||||
exports.glo_v2_public = void 0;
|
||||
var glo_v3_private;
|
||||
exports.glo_v4_public = void 0; // error
|
||||
var glo_v11_private = new glo_C1_public();
|
||||
exports.glo_v12_public = new glo_C1_public();
|
||||
var glo_v13_private = new glo_C2_private();
|
||||
|
||||
@@ -460,6 +460,8 @@ var privateClassWithWithPublicPropertyTypes = /** @class */ (function () {
|
||||
}
|
||||
return privateClassWithWithPublicPropertyTypes;
|
||||
}());
|
||||
exports.publicVarWithPrivatePropertyTypes = void 0; // Error
|
||||
exports.publicVarWithPublicPropertyTypes = void 0;
|
||||
var privateVarWithPrivatePropertyTypes;
|
||||
var privateVarWithPublicPropertyTypes;
|
||||
var publicClassWithPrivateModulePropertyTypes = /** @class */ (function () {
|
||||
@@ -468,6 +470,7 @@ var publicClassWithPrivateModulePropertyTypes = /** @class */ (function () {
|
||||
return publicClassWithPrivateModulePropertyTypes;
|
||||
}());
|
||||
exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes;
|
||||
exports.publicVarWithPrivateModulePropertyTypes = void 0; // Error
|
||||
var privateClassWithPrivateModulePropertyTypes = /** @class */ (function () {
|
||||
function privateClassWithPrivateModulePropertyTypes() {
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ var d = /** @class */ (function () {
|
||||
}());
|
||||
exports.d = d;
|
||||
;
|
||||
exports.x = void 0;
|
||||
function foo() {
|
||||
return new d();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ class C {
|
||||
//// [protoAsIndexInIndexExpression_0.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
//// [protoAsIndexInIndexExpression_1.js]
|
||||
///<reference path='protoAsIndexInIndexExpression_0.ts'/>
|
||||
var EntityPrototype = undefined;
|
||||
|
||||
@@ -30,4 +30,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0; // This should result in type ClassB
|
||||
});
|
||||
@@ -34,4 +34,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0; // This should result in type ClassB
|
||||
});
|
||||
@@ -38,4 +38,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0; // This should result in type ClassB
|
||||
});
|
||||
@@ -32,4 +32,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0; // This should result in type ClassB
|
||||
});
|
||||
@@ -41,4 +41,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0; // This should result in type ClassB
|
||||
});
|
||||
@@ -50,4 +50,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0; // This should result in type ClassB
|
||||
});
|
||||
@@ -52,4 +52,5 @@ define(["require", "exports"], function (require, exports) {
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.b = void 0; // This should result in type ClassB
|
||||
});
|
||||
@@ -21,6 +21,8 @@ b = {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.a.___foo;
|
||||
// @filename def.ts
|
||||
exports.b = void 0;
|
||||
exports.b = {
|
||||
___foo: 100
|
||||
};
|
||||
@@ -15,6 +15,7 @@ var z = foo.x + fum.y;
|
||||
//// [foo_0.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
//// [foo_1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
|
||||
+9
-1
@@ -120,7 +120,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct
|
||||
//// [/a/b/moduleFile1.ts]
|
||||
export var T: number;export function Foo() { };
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
|
||||
Output::
|
||||
>> Screen clear
|
||||
|
||||
+9
-1
@@ -118,7 +118,15 @@ Change:: change moduleFile1 shape and delete file1Consumer2
|
||||
//// [/a/b/moduleFile1.ts]
|
||||
export var T: number;export function Foo() { };
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1.js] file written with same contents
|
||||
//// [/a/b/file1Consumer2.ts] deleted
|
||||
|
||||
|
||||
+9
-1
@@ -118,7 +118,15 @@ Change:: change moduleFile1 shape and create file1Consumer3
|
||||
//// [/a/b/moduleFile1.ts]
|
||||
export var T: number;export function Foo() { };
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1.js] file written with same contents
|
||||
//// [/a/b/file1Consumer2.js] file written with same contents
|
||||
//// [/a/b/file1Consumer3.ts]
|
||||
|
||||
+10
-1
@@ -180,7 +180,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct
|
||||
//// [/a/b/moduleFile1.ts]
|
||||
export var T: number;export function Foo() { };
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer2.js] file written with same contents
|
||||
|
||||
Output::
|
||||
@@ -374,6 +382,7 @@ export var T: number;export function Foo() { };
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
+10
-1
@@ -118,7 +118,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct
|
||||
//// [/a/b/moduleFile1.ts]
|
||||
export var T: number;export function Foo() { };
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1.js] file written with same contents
|
||||
//// [/a/b/file1Consumer2.js] file written with same contents
|
||||
|
||||
@@ -180,6 +188,7 @@ export var T: number;export function Foo() { console.log('hi'); };
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { console.log('hi'); }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
+10
-1
@@ -89,7 +89,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct
|
||||
//// [/a/b/moduleFile1.ts]
|
||||
export var T: number;export function Foo() { };
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1.js] file written with same contents
|
||||
|
||||
Output::
|
||||
@@ -138,6 +146,7 @@ export var T: number;export function Foo() { };var T1: number;
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
+33
-4
@@ -130,7 +130,13 @@ Change:: change file1Consumer1
|
||||
//// [/a/b/file1Consumer1.ts]
|
||||
import {Foo} from "./moduleFile1"; export var y = 10;export var T: number;
|
||||
|
||||
//// [/a/b/file1Consumer1.js] file written with same contents
|
||||
//// [/a/b/file1Consumer1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.y = 10;
|
||||
exports.T = void 0;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1Consumer1.js] file written with same contents
|
||||
|
||||
Output::
|
||||
@@ -190,7 +196,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct
|
||||
//// [/a/b/moduleFile1.ts]
|
||||
export var T: number;export function Foo() { };
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1.js] file written with same contents
|
||||
//// [/a/b/file1Consumer2.js] file written with same contents
|
||||
|
||||
@@ -255,8 +269,23 @@ export var T2: number;export function Foo() { };
|
||||
//// [/a/b/file1Consumer1.ts]
|
||||
import {Foo} from "./moduleFile1"; export var y = 10;export var T: number;export var T2: number;
|
||||
|
||||
//// [/a/b/moduleFile1.js] file written with same contents
|
||||
//// [/a/b/file1Consumer1.js] file written with same contents
|
||||
//// [/a/b/moduleFile1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.T2 = void 0;
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.y = 10;
|
||||
exports.T = void 0;
|
||||
exports.T2 = void 0;
|
||||
|
||||
|
||||
//// [/a/b/file1Consumer1Consumer1.js] file written with same contents
|
||||
//// [/a/b/file1Consumer2.js] file written with same contents
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ else {
|
||||
}
|
||||
// exported variable in external module
|
||||
var strOrNum;
|
||||
exports.var2 = void 0;
|
||||
if (typeof exports.var2 === "string") {
|
||||
// export makes the var property and not variable
|
||||
strOrNum = exports.var2; // string | number
|
||||
|
||||
@@ -19,6 +19,7 @@ export let y = () => x
|
||||
/// <reference types="lib"/>
|
||||
exports.__esModule = true;
|
||||
exports.$ = 1;
|
||||
exports.x = void 0;
|
||||
exports.y = function () { return exports.x; };
|
||||
|
||||
|
||||
|
||||
@@ -55,14 +55,23 @@ export var r13: typeof foo;
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var x = 1;
|
||||
exports.r1 = void 0;
|
||||
var y = { foo: '' };
|
||||
exports.r2 = void 0;
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
exports.c = void 0;
|
||||
var c2;
|
||||
exports.r3 = void 0;
|
||||
exports.r4 = void 0;
|
||||
exports.r4b = void 0;
|
||||
exports.i = void 0;
|
||||
var i2;
|
||||
exports.r5 = void 0;
|
||||
exports.r5 = void 0;
|
||||
var M;
|
||||
(function (M) {
|
||||
M.foo = '';
|
||||
@@ -73,10 +82,17 @@ var M;
|
||||
}());
|
||||
M.C = C;
|
||||
})(M || (M = {}));
|
||||
exports.r6 = void 0;
|
||||
exports.r7 = void 0;
|
||||
exports.r8 = void 0;
|
||||
exports.r9 = void 0;
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["A"] = 0] = "A";
|
||||
})(E || (E = {}));
|
||||
exports.r10 = void 0;
|
||||
exports.r11 = void 0;
|
||||
exports.r12 = void 0;
|
||||
function foo() { }
|
||||
(function (foo) {
|
||||
foo.y = 1;
|
||||
@@ -87,3 +103,4 @@ function foo() { }
|
||||
}());
|
||||
foo.C = C;
|
||||
})(foo || (foo = {}));
|
||||
exports.r13 = void 0;
|
||||
@@ -55,15 +55,24 @@ export var r13: typeof foo;
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = 1;
|
||||
exports.r1 = void 0;
|
||||
exports.y = { foo: '' };
|
||||
exports.r2 = void 0;
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
exports.C = C;
|
||||
exports.c = void 0;
|
||||
var c2;
|
||||
exports.r3 = void 0;
|
||||
exports.r4 = void 0;
|
||||
exports.r4b = void 0;
|
||||
exports.i = void 0;
|
||||
var i2;
|
||||
exports.r5 = void 0;
|
||||
exports.r5 = void 0;
|
||||
var M;
|
||||
(function (M) {
|
||||
M.foo = '';
|
||||
@@ -74,11 +83,18 @@ var M;
|
||||
}());
|
||||
M.C = C;
|
||||
})(M = exports.M || (exports.M = {}));
|
||||
exports.r6 = void 0;
|
||||
exports.r7 = void 0;
|
||||
exports.Z = M;
|
||||
exports.r8 = void 0;
|
||||
exports.r9 = void 0;
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["A"] = 0] = "A";
|
||||
})(E = exports.E || (exports.E = {}));
|
||||
exports.r10 = void 0;
|
||||
exports.r11 = void 0;
|
||||
exports.r12 = void 0;
|
||||
function foo() { }
|
||||
exports.foo = foo;
|
||||
(function (foo) {
|
||||
@@ -90,3 +106,4 @@ exports.foo = foo;
|
||||
}());
|
||||
foo.C = C;
|
||||
})(foo = exports.foo || (exports.foo = {}));
|
||||
exports.r13 = void 0;
|
||||
@@ -34,3 +34,5 @@ export as namespace C2;
|
||||
//// [err5.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
// Illegal, may not appear in implementation files
|
||||
exports.v = void 0;
|
||||
@@ -9,3 +9,4 @@ export var y: string;
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var x;
|
||||
exports.y = void 0;
|
||||
@@ -63,6 +63,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var simpleVar;
|
||||
exports.exportedSimpleVar = void 0;
|
||||
var anotherVar;
|
||||
var varWithSimpleType;
|
||||
var varWithArrayType;
|
||||
@@ -71,6 +72,7 @@ define(["require", "exports"], function (require, exports) {
|
||||
var withComplicatedValue = { x: 30, y: 70, desc: "position" };
|
||||
exports.exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" };
|
||||
var arrayVar = ['a', 'b'];
|
||||
exports.exportedArrayVar = void 0;
|
||||
exports.exportedArrayVar.push({ x: 30, y: 'hello world' });
|
||||
function simpleFunction() {
|
||||
return {
|
||||
@@ -97,9 +99,9 @@ define(["require", "exports"], function (require, exports) {
|
||||
}
|
||||
m3.foo = foo;
|
||||
})(m3 = exports.m3 || (exports.m3 = {}));
|
||||
exports.eVar2 = 10;
|
||||
exports.eVar1 = void 0, exports.eVar2 = 10;
|
||||
var eVar22;
|
||||
exports.eVar3 = 10;
|
||||
exports.eVar3 = 10, exports.eVar4 = void 0, exports.eVar5 = void 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user