Fix namespace import/export helper usage

This commit is contained in:
Ron Buckton committed 2020-07-07 17:36:59 -07:00
1 parent 62b4377acf
commit 5c5f180f8e
71 files changed
+1372 -12

No files matched your search

+19 -1
View File
@@ -35287,6 +35287,10 @@ namespace ts {
if (importClause.namedBindings) {
if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
checkImportBinding(importClause.namedBindings);
if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015 && compilerOptions.esModuleInterop) {
// import * as ns from "foo";
checkExternalEmitHelpers(node, ExternalEmitHelpers.ImportStar);
}
}
else {
const moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier);
@@ -35297,6 +35301,7 @@ namespace ts {
}
}
}
}
function checkImportEqualsDeclaration(node: ImportEqualsDeclaration) {
@@ -35364,6 +35369,7 @@ namespace ts {
}
else {
// export * from "foo"
// export * as ns from "foo";
const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier!);
if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
@@ -35372,7 +35378,18 @@ namespace ts {
checkAliasSymbol(node.exportClause);
}
if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015) {
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
if (node.exportClause) {
// export * as ns from "foo";
// For ES2015 modules, we emit it as a pair of `import * as a_1 ...; export { a_1 as ns }` and don't need the helper.
// We only use the helper here when in esModuleInterop
if (compilerOptions.esModuleInterop) {
checkExternalEmitHelpers(node, ExternalEmitHelpers.ImportStar);
}
}
else {
// export * from "foo"
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
}
}
}
}
@@ -37628,6 +37645,7 @@ namespace ts {
case ExternalEmitHelpers.AsyncDelegator: return "__asyncDelegator";
case ExternalEmitHelpers.AsyncValues: return "__asyncValues";
case ExternalEmitHelpers.ExportStar: return "__exportStar";
case ExternalEmitHelpers.ImportStar: return "__importStar";
case ExternalEmitHelpers.MakeTemplateObject: return "__makeTemplateObject";
case ExternalEmitHelpers.ClassPrivateFieldGet: return "__classPrivateFieldGet";
case ExternalEmitHelpers.ClassPrivateFieldSet: return "__classPrivateFieldSet";
+3 -3
View File
@@ -1051,9 +1051,9 @@ namespace ts {
factory.createExpressionStatement(
createExportExpression(
factory.cloneNode(node.exportClause.name),
moduleKind !== ModuleKind.AMD ?
getHelperExpressionForExport(node, createRequireCall(node)) :
factory.createIdentifier(idText(node.exportClause.name))
getHelperExpressionForExport(node, moduleKind !== ModuleKind.AMD ?
createRequireCall(node) :
factory.createIdentifier(idText(node.exportClause.name)))
)
),
node
+2
View File
@@ -122,6 +122,8 @@ namespace ts {
uniqueExports.set(idText(name), true);
exportedNames = append(exportedNames, name);
}
// we use the same helpers for `export * as ns` as we do for `import * as ns`
hasImportStar = true;
}
}
}
+5 -4
View File
@@ -6414,10 +6414,11 @@ namespace ts {
AsyncDelegator = 1 << 14, // __asyncDelegator (used by ES2017 async generator yield* transformation)
AsyncValues = 1 << 15, // __asyncValues (used by ES2017 for..await..of transformation)
ExportStar = 1 << 16, // __exportStar (used by CommonJS/AMD/UMD module transformation)
MakeTemplateObject = 1 << 17, // __makeTemplateObject (used for constructing template string array objects)
ClassPrivateFieldGet = 1 << 18, // __classPrivateFieldGet (used by the class private field transformation)
ClassPrivateFieldSet = 1 << 19, // __classPrivateFieldSet (used by the class private field transformation)
CreateBinding = 1 << 20, // __createBinding (use by the module transform for (re)exports and namespace imports)
ImportStar = 1 << 17, // __importStar (used by CommonJS/AMD/UMD module transformation)
MakeTemplateObject = 1 << 18, // __makeTemplateObject (used for constructing template string array objects)
ClassPrivateFieldGet = 1 << 19, // __classPrivateFieldGet (used by the class private field transformation)
ClassPrivateFieldSet = 1 << 20, // __classPrivateFieldSet (used by the class private field transformation)
CreateBinding = 1 << 21, // __createBinding (use by the module transform for (re)exports and namespace imports)
FirstEmitHelper = Extends,
LastEmitHelper = CreateBinding,
+1 -2
View File
@@ -159,13 +159,12 @@ namespace Harness {
let configuredName = "";
const keys = Object
.keys(configurationOverrides)
.map(k => k.toLowerCase())
.sort();
for (const key of keys) {
if (configuredName) {
configuredName += ",";
}
configuredName += `${key}=${configurationOverrides[key].toLowerCase()}`;
configuredName += `${key.toLowerCase()}=${configurationOverrides[key].toLowerCase()}`;
}
if (configuredName) {
const extname = vpath.extname(this.justName);
@@ -0,0 +1,23 @@
tests/cases/compiler/file2.ts(1,1): error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.
==== tests/cases/compiler/refs.d.ts (0 errors) ====
declare module "path";
==== tests/cases/compiler/file.ts (0 errors) ====
import path from "path";
path.resolve("", "../");
export class Foo { }
==== tests/cases/compiler/file2.ts (1 errors) ====
import * as path from "path";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.
path.resolve("", "../");
export class Foo2 { }
==== tests/cases/compiler/file3.ts (0 errors) ====
import {default as resolve} from "path";
resolve("", "../");
export class Foo3 { }
==== tests/cases/compiler/file4.ts (0 errors) ====
import {Bar, default as resolve} from "path";
resolve("", "../");
export { Bar }
@@ -24,11 +24,30 @@ define(["require", "exports"], function (require, exports) {
exports.b = 2;
});
//// [1.js]
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
define(["require", "exports", "./0"], function (require, exports, ns) {
"use strict";
exports.__esModule = true;
exports.ns = void 0;
exports.ns = ns;
exports.ns = __importStar(ns);
ns.a;
ns.b;
});
@@ -27,11 +27,30 @@ define(["require", "exports"], function (require, exports) {
exports.b = 2;
});
//// [1.js]
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
define(["require", "exports", "./0"], function (require, exports, ns) {
"use strict";
exports.__esModule = true;
exports.ns = void 0;
exports.ns = ns;
exports.ns = __importStar(ns);
ns.a;
ns.b;
var ns = { a: 1, b: 2 };
@@ -0,0 +1,29 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
});
//// [b.js]
define(["require", "exports", "./a"], function (require, exports, a) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
exports.a = a;
});
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,25 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
//// [b.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
exports.a = require("./a");
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,19 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
import * as a_1 from "./a";
export { a_1 as a };
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,18 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
export * as a from "./a";
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,41 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
System.register([], function (exports_1, context_1) {
"use strict";
var A;
var __moduleName = context_1 && context_1.id;
return {
setters: [],
execute: function () {
A = class A {
};
exports_1("A", A);
}
};
});
//// [b.js]
System.register(["./a"], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
return {
setters: [
function (a_1) {
exports_1("a", a_1);
}
],
execute: function () {
}
};
});
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,29 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
});
//// [b.js]
define(["require", "exports", "tslib", "./a"], function (require, exports, tslib_1, a) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
exports.a = tslib_1.__importStar(a);
});
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,26 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
//// [b.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
const tslib_1 = require("tslib");
exports.a = tslib_1.__importStar(require("./a"));
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,19 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
import * as a_1 from "./a";
export { a_1 as a };
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,18 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
export * as a from "./a";
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,41 @@
//// [tests/cases/compiler/importHelpersWithExportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
export * as a from "./a";
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
System.register([], function (exports_1, context_1) {
"use strict";
var A;
var __moduleName = context_1 && context_1.id;
return {
setters: [],
execute: function () {
A = class A {
};
exports_1("A", A);
}
};
});
//// [b.js]
System.register(["./a"], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
return {
setters: [
function (a_1) {
exports_1("a", a_1);
}
],
execute: function () {
}
};
});
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
export * as a from "./a";
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,30 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
});
//// [b.js]
define(["require", "exports", "./a"], function (require, exports, a) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
exports.a = a;
});
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,27 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
//// [b.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
const a = require("./a");
exports.a = a;
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,20 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
import * as a from "./a";
export { a };
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,20 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
import * as a from "./a";
export { a };
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,44 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
System.register([], function (exports_1, context_1) {
"use strict";
var A;
var __moduleName = context_1 && context_1.id;
return {
setters: [],
execute: function () {
A = class A {
};
exports_1("A", A);
}
};
});
//// [b.js]
System.register(["./a"], function (exports_1, context_1) {
"use strict";
var a;
var __moduleName = context_1 && context_1.id;
return {
setters: [
function (a_1) {
a = a_1;
}
],
execute: function () {
exports_1("a", a);
}
};
});
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,31 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
});
//// [b.js]
define(["require", "exports", "tslib", "./a"], function (require, exports, tslib_1, a) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
a = tslib_1.__importStar(a);
exports.a = a;
});
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,28 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
class A {
}
exports.A = A;
//// [b.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = void 0;
const tslib_1 = require("tslib");
const a = tslib_1.__importStar(require("./a"));
exports.a = a;
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,20 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
import * as a from "./a";
export { a };
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,20 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
export class A {
}
//// [b.js]
import * as a from "./a";
export { a };
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,44 @@
//// [tests/cases/compiler/importHelpersWithImportStarAs.ts] ////
//// [a.ts]
export class A { }
//// [b.ts]
import * as a from "./a";
export { a };
//// [tslib.d.ts]
declare module "tslib" {
function __importStar(m: any): void;
}
//// [a.js]
System.register([], function (exports_1, context_1) {
"use strict";
var A;
var __moduleName = context_1 && context_1.id;
return {
setters: [],
execute: function () {
A = class A {
};
exports_1("A", A);
}
};
});
//// [b.js]
System.register(["./a"], function (exports_1, context_1) {
"use strict";
var a;
var __moduleName = context_1 && context_1.id;
return {
setters: [
function (a_1) {
a = a_1;
}
],
execute: function () {
exports_1("a", a);
}
};
});
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : Symbol(a, Decl(b.ts, 0, 6))
export { a };
>a : Symbol(a, Decl(b.ts, 1, 8))
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : Symbol("tslib", Decl(tslib.d.ts, --, --))
function __importStar(m: any): void;
>__importStar : Symbol(__importStar, Decl(tslib.d.ts, --, --))
>m : Symbol(m, Decl(tslib.d.ts, --, --))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export class A { }
>A : A
=== tests/cases/compiler/b.ts ===
import * as a from "./a";
>a : typeof a
export { a };
>a : typeof a
=== tests/cases/compiler/tslib.d.ts ===
declare module "tslib" {
>"tslib" : typeof import("tslib")
function __importStar(m: any): void;
>__importStar : (m: any) => void
>m : any
}
@@ -0,0 +1,14 @@
// @importHelpers: true
// @target: es2017
// @module: commonjs,system,amd,es2015,es2020
// @esModuleInterop: true,false
// @filename: a.ts
export class A { }
// @filename: b.ts
export * as a from "./a";
// @filename: tslib.d.ts
declare module "tslib" {
function __importStar(m: any): void;
}
@@ -0,0 +1,15 @@
// @importHelpers: true
// @target: es2017
// @module: commonjs,system,amd,es2015,es2020
// @esModuleInterop: true,false
// @filename: a.ts
export class A { }
// @filename: b.ts
import * as a from "./a";
export { a };
// @filename: tslib.d.ts
declare module "tslib" {
function __importStar(m: any): void;
}
@@ -1,5 +1,6 @@
// @module: commonjs
// @importHelpers: true
// @esModuleInterop: true
// @noTypesAndSymbols: true
// @Filename: a.ts