diff --git a/lib/internal/modules/helpers.js b/lib/internal/modules/helpers.js index 729a33e04f34cd..c4cf82fe49f349 100644 --- a/lib/internal/modules/helpers.js +++ b/lib/internal/modules/helpers.js @@ -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) { diff --git a/test/es-module/test-typescript-transform.mjs b/test/es-module/test-typescript-transform.mjs index 85a5cf96f3cc02..06faa3ddfcf932 100644 --- a/test/es-module/test-typescript-transform.mjs +++ b/test/es-module/test-typescript-transform.mjs @@ -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); +}); diff --git a/test/fixtures/typescript/cts/test-import-require.cts b/test/fixtures/typescript/cts/test-import-require.cts new file mode 100644 index 00000000000000..2d21a9c6ec3d66 --- /dev/null +++ b/test/fixtures/typescript/cts/test-import-require.cts @@ -0,0 +1,5 @@ +import util = require("node:util"); + +const foo: string = "Hello, TypeScript!"; + +console.log(util.styleText(["red"], foo));