Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: use amaro default transform values #54517

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/internal/modules/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,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));
Loading