summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r--cli/tsc/99_main_compiler.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index 362fdd762..ac036f082 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -30,6 +30,15 @@ delete Object.prototype.__proto__;
// See: https://github.com/denoland/deno/issues/9277#issuecomment-769653834
const normalizedToOriginalMap = new Map();
+ /**
+ * @param {unknown} value
+ * @returns {value is ts.CreateSourceFileOptions}
+ */
+ function isCreateSourceFileOptions(value) {
+ return value != null && typeof value === "object" &&
+ "languageVersion" in value;
+ }
+
function setLogDebug(debug, source) {
logDebug = debug;
if (source) {
@@ -290,7 +299,11 @@ delete Object.prototype.__proto__;
) {
debug(
`host.getSourceFile("${specifier}", ${
- ts.ScriptTarget[languageVersion]
+ ts.ScriptTarget[
+ isCreateSourceFileOptions(languageVersion)
+ ? languageVersion.languageVersion
+ : languageVersion
+ ]
})`,
);
@@ -302,7 +315,7 @@ delete Object.prototype.__proto__;
return sourceFile;
}
- /** @type {{ data: string; scriptKind: ts.ScriptKind }} */
+ /** @type {{ data: string; scriptKind: ts.ScriptKind; version: string; }} */
const { data, scriptKind, version } = core.opSync(
"op_load",
{ specifier },