From 6ff939553216125ce058a070d91b7eb430cc4665 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 8 Sep 2020 15:28:42 +0200 Subject: feat(unstable): enable isolatedModules by default (#7327) --- cli/tsc/99_main_compiler.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'cli/tsc') diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index dede279c1..a2e127508 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -878,6 +878,13 @@ delete Object.prototype.__proto__; 7016, ]; + const IGNORED_COMPILE_DIAGNOSTICS = [ + // TS1208: All files must be modules when the '--isolatedModules' flag is + // provided. We can ignore because we guarantuee that all files are + // modules. + 1208, + ]; + const stats = []; let statsStart = 0; @@ -1162,7 +1169,9 @@ delete Object.prototype.__proto__; ...program.getSemanticDiagnostics(), ]; diagnostics = diagnostics.filter( - ({ code }) => !IGNORED_DIAGNOSTICS.includes(code), + ({ code }) => + !IGNORED_DIAGNOSTICS.includes(code) && + !IGNORED_COMPILE_DIAGNOSTICS.includes(code), ); // We will only proceed with the emit if there are no diagnostics. @@ -1333,7 +1342,10 @@ delete Object.prototype.__proto__; const diagnostics = ts .getPreEmitDiagnostics(program) - .filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code)); + .filter(({ code }) => + !IGNORED_DIAGNOSTICS.includes(code) && + !IGNORED_COMPILE_DIAGNOSTICS.includes(code) + ); const emitResult = program.emit(); assert(emitResult.emitSkipped === false, "Unexpected skip of the emit."); -- cgit v1.2.3