Skip to content

Commit

Permalink
module: use amaro default transform values
Browse files Browse the repository at this point in the history
PR-URL: #54517
Fixes: #54514
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
  • Loading branch information
marco-ippolito authored and RafaelGSS committed Aug 30, 2024
1 parent 101e299 commit 3cf6457
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/internal/modules/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,6 @@ function stripTypeScriptTypes(source, filename) {
mode: typeScriptParsingMode,
sourceMap: sourceMapEnabled,
filename,
// Transform option is only applied in transform mode.
transform: {
verbatimModuleSyntax: true,
},
};
const { code, map } = parse(source, options);
if (map) {
Expand Down
12 changes: 12 additions & 0 deletions test/es-module/test-typescript-transform.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,15 @@ test('execute a transpiled JavaScript file', async () => {
strictEqual(result.stdout, '');
strictEqual(result.code, 1);
});

test('execute TypeScript file with import = require', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-transform-types',
'--no-warnings',
fixtures.path('typescript/cts/test-import-require.cts'),
]);

strictEqual(result.stderr, '');
match(result.stdout, /Hello, TypeScript!/);
strictEqual(result.code, 0);
});
5 changes: 5 additions & 0 deletions test/fixtures/typescript/cts/test-import-require.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import util = require("node:util");

const foo: string = "Hello, TypeScript!";

console.log(util.styleText(["red"], foo));

0 comments on commit 3cf6457

Please sign in to comment.