Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call dynamic import transform on expression used by export equal stat…
…ement (#18028) (#18033) * Call dynamic import transform on expression used by export equal statement * Use Debug.fail
- Loading branch information
Showing
13 changed files
with
204 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/importCallExpressionInExportEqualsAMD.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//// [tests/cases/conformance/dynamicImport/importCallExpressionInExportEqualsAMD.ts] //// | ||
|
||
//// [something.ts] | ||
export = 42; | ||
|
||
//// [index.ts] | ||
export = async function() { | ||
const something = await import("./something"); | ||
}; | ||
|
||
//// [something.js] | ||
define(["require", "exports"], function (require, exports) { | ||
"use strict"; | ||
return 42; | ||
}); | ||
//// [index.js] | ||
define(["require", "exports"], function (require, exports) { | ||
"use strict"; | ||
return async function () { | ||
const something = await new Promise(function (resolve_1, reject_1) { require(["./something"], resolve_1, reject_1); }); | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/importCallExpressionInExportEqualsAMD.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
=== tests/cases/conformance/dynamicImport/something.ts === | ||
export = 42; | ||
No type information for this code. | ||
No type information for this code.=== tests/cases/conformance/dynamicImport/index.ts === | ||
export = async function() { | ||
const something = await import("./something"); | ||
>something : Symbol(something, Decl(index.ts, 1, 9)) | ||
>"./something" : Symbol("tests/cases/conformance/dynamicImport/something", Decl(something.ts, 0, 0)) | ||
|
||
}; |
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/importCallExpressionInExportEqualsAMD.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/conformance/dynamicImport/something.ts === | ||
export = 42; | ||
No type information for this code. | ||
No type information for this code.=== tests/cases/conformance/dynamicImport/index.ts === | ||
export = async function() { | ||
>async function() { const something = await import("./something");} : () => Promise<void> | ||
|
||
const something = await import("./something"); | ||
>something : 42 | ||
>await import("./something") : 42 | ||
>import("./something") : Promise<42> | ||
>"./something" : "./something" | ||
|
||
}; |
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/importCallExpressionInExportEqualsCJS.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//// [tests/cases/conformance/dynamicImport/importCallExpressionInExportEqualsCJS.ts] //// | ||
|
||
//// [something.ts] | ||
export = 42; | ||
|
||
//// [index.ts] | ||
export = async function() { | ||
const something = await import("./something"); | ||
}; | ||
|
||
//// [something.js] | ||
"use strict"; | ||
module.exports = 42; | ||
//// [index.js] | ||
"use strict"; | ||
module.exports = async function () { | ||
const something = await Promise.resolve().then(function () { return require("./something"); }); | ||
}; |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/importCallExpressionInExportEqualsCJS.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
=== tests/cases/conformance/dynamicImport/something.ts === | ||
export = 42; | ||
No type information for this code. | ||
No type information for this code.=== tests/cases/conformance/dynamicImport/index.ts === | ||
export = async function() { | ||
const something = await import("./something"); | ||
>something : Symbol(something, Decl(index.ts, 1, 9)) | ||
>"./something" : Symbol("tests/cases/conformance/dynamicImport/something", Decl(something.ts, 0, 0)) | ||
|
||
}; |
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/importCallExpressionInExportEqualsCJS.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/conformance/dynamicImport/something.ts === | ||
export = 42; | ||
No type information for this code. | ||
No type information for this code.=== tests/cases/conformance/dynamicImport/index.ts === | ||
export = async function() { | ||
>async function() { const something = await import("./something");} : () => Promise<void> | ||
|
||
const something = await import("./something"); | ||
>something : 42 | ||
>await import("./something") : 42 | ||
>import("./something") : Promise<42> | ||
>"./something" : "./something" | ||
|
||
}; |
39 changes: 39 additions & 0 deletions
39
tests/baselines/reference/importCallExpressionInExportEqualsUMD.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//// [tests/cases/conformance/dynamicImport/importCallExpressionInExportEqualsUMD.ts] //// | ||
|
||
//// [something.ts] | ||
export = 42; | ||
|
||
//// [index.ts] | ||
export = async function() { | ||
const something = await import("./something"); | ||
}; | ||
|
||
//// [something.js] | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
return 42; | ||
}); | ||
//// [index.js] | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
var __syncRequire = typeof module === "object" && typeof module.exports === "object"; | ||
return async function () { | ||
const something = await (__syncRequire ? Promise.resolve().then(function () { return require("./something"); }) : new Promise(function (resolve_1, reject_1) { require(["./something"], resolve_1, reject_1); })); | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/importCallExpressionInExportEqualsUMD.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
=== tests/cases/conformance/dynamicImport/something.ts === | ||
export = 42; | ||
No type information for this code. | ||
No type information for this code.=== tests/cases/conformance/dynamicImport/index.ts === | ||
export = async function() { | ||
const something = await import("./something"); | ||
>something : Symbol(something, Decl(index.ts, 1, 9)) | ||
>"./something" : Symbol("tests/cases/conformance/dynamicImport/something", Decl(something.ts, 0, 0)) | ||
|
||
}; |
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/importCallExpressionInExportEqualsUMD.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/conformance/dynamicImport/something.ts === | ||
export = 42; | ||
No type information for this code. | ||
No type information for this code.=== tests/cases/conformance/dynamicImport/index.ts === | ||
export = async function() { | ||
>async function() { const something = await import("./something");} : () => Promise<void> | ||
|
||
const something = await import("./something"); | ||
>something : 42 | ||
>await import("./something") : 42 | ||
>import("./something") : Promise<42> | ||
>"./something" : "./something" | ||
|
||
}; |
9 changes: 9 additions & 0 deletions
9
tests/cases/conformance/dynamicImport/importCallExpressionInExportEqualsAMD.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @module: amd | ||
// @target: esnext | ||
// @filename: something.ts | ||
export = 42; | ||
|
||
// @filename: index.ts | ||
export = async function() { | ||
const something = await import("./something"); | ||
}; |
9 changes: 9 additions & 0 deletions
9
tests/cases/conformance/dynamicImport/importCallExpressionInExportEqualsCJS.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @module: commonjs | ||
// @target: esnext | ||
// @filename: something.ts | ||
export = 42; | ||
|
||
// @filename: index.ts | ||
export = async function() { | ||
const something = await import("./something"); | ||
}; |
9 changes: 9 additions & 0 deletions
9
tests/cases/conformance/dynamicImport/importCallExpressionInExportEqualsUMD.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @module: umd | ||
// @target: esnext | ||
// @filename: something.ts | ||
export = 42; | ||
|
||
// @filename: index.ts | ||
export = async function() { | ||
const something = await import("./something"); | ||
}; |