diff --git a/lib/tsc.js b/lib/tsc.js index 7c6da53912ca2979b68baa00a1d2a4730e81ec21..bb7242611d60b13ac5039aa8584803585085fc70 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -103285,7 +103285,8 @@ var ts; if (result) return result; } - var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); + var checker = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.scriptKind) === 8 ? getLinterTypeChecker() : getTypeChecker(); + var emitResolver = checker.getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, false, forceDtsEmit); ts.performance.mark("afterEmit"); @@ -103390,6 +103391,12 @@ var ts; if (ts.skipTypeChecking(sourceFile, options, program)) { return ts.emptyArray; } + if (isForLinter && sourceFile.scriptKind !== 8) { + return ts.emptyArray; + } + if (!isForLinter && sourceFile.scriptKind === 8) { + return ts.emptyArray; + } var typeChecker = isForLinter ? getLinterTypeChecker() : getTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var isJs = sourceFile.scriptKind === 1 || sourceFile.scriptKind === 2; diff --git a/lib/tsserver.js b/lib/tsserver.js index b578cf4c184406b07616d35f246c1a55117a8bb7..2d14cba6c1017e349ad24ed5cc12d9b99819565d 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -39144,7 +39144,7 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function isSetLazy(identifier) { - // 1. import lazy { export } from "mod"; + // 1. import lazy { export } from "mod"; // 2. import lazy defaultExport from "mod"; // 3. import lazy defaultExport, { export, /* ... */ } from "mod"; return (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === 'lazy' && @@ -124405,7 +124405,8 @@ var ts; // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); + var checker = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.scriptKind) === 8 /* ScriptKind.ETS */ ? getLinterTypeChecker() : getTypeChecker(); + var emitResolver = checker.getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, /*onlyBuildInfo*/ false, forceDtsEmit); @@ -124517,6 +124518,12 @@ var ts; if (ts.skipTypeChecking(sourceFile, options, program)) { return ts.emptyArray; } + if (isForLinter && sourceFile.scriptKind !== 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } + if (!isForLinter && sourceFile.scriptKind === 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } var typeChecker = isForLinter ? getLinterTypeChecker() : getTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var isJs = sourceFile.scriptKind === 1 /* ScriptKind.JS */ || sourceFile.scriptKind === 2 /* ScriptKind.JSX */; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index ebee2765fb54ea46d889c20b39a8207acb0736dd..3af22b157978590bea82536a036049e5f56c6ff2 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -39143,7 +39143,7 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function isSetLazy(identifier) { - // 1. import lazy { export } from "mod"; + // 1. import lazy { export } from "mod"; // 2. import lazy defaultExport from "mod"; // 3. import lazy defaultExport, { export, /* ... */ } from "mod"; return (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === 'lazy' && @@ -124404,7 +124404,8 @@ var ts; // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); + var checker = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.scriptKind) === 8 /* ScriptKind.ETS */ ? getLinterTypeChecker() : getTypeChecker(); + var emitResolver = checker.getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, /*onlyBuildInfo*/ false, forceDtsEmit); @@ -124516,6 +124517,12 @@ var ts; if (ts.skipTypeChecking(sourceFile, options, program)) { return ts.emptyArray; } + if (isForLinter && sourceFile.scriptKind !== 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } + if (!isForLinter && sourceFile.scriptKind === 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } var typeChecker = isForLinter ? getLinterTypeChecker() : getTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var isJs = sourceFile.scriptKind === 1 /* ScriptKind.JS */ || sourceFile.scriptKind === 2 /* ScriptKind.JSX */; diff --git a/lib/typescript.js b/lib/typescript.js index ec37e2214a8e8ea4b781c7263b4be3391d4124c5..4dcf78e3bfedc318ea7253c24158e186c6502a7a 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -39134,7 +39134,7 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function isSetLazy(identifier) { - // 1. import lazy { export } from "mod"; + // 1. import lazy { export } from "mod"; // 2. import lazy defaultExport from "mod"; // 3. import lazy defaultExport, { export, /* ... */ } from "mod"; return (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === 'lazy' && @@ -124395,7 +124395,8 @@ var ts; // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); + var checker = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.scriptKind) === 8 /* ScriptKind.ETS */ ? getLinterTypeChecker() : getTypeChecker(); + var emitResolver = checker.getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, /*onlyBuildInfo*/ false, forceDtsEmit); @@ -124507,6 +124508,12 @@ var ts; if (ts.skipTypeChecking(sourceFile, options, program)) { return ts.emptyArray; } + if (isForLinter && sourceFile.scriptKind !== 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } + if (!isForLinter && sourceFile.scriptKind === 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } var typeChecker = isForLinter ? getLinterTypeChecker() : getTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var isJs = sourceFile.scriptKind === 1 /* ScriptKind.JS */ || sourceFile.scriptKind === 2 /* ScriptKind.JSX */; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 70e94c031366a9424a7ed47470a250f35d2d8031..1eb8800d89a3fa92160203d79b02a57b7282bb97 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -39134,7 +39134,7 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function isSetLazy(identifier) { - // 1. import lazy { export } from "mod"; + // 1. import lazy { export } from "mod"; // 2. import lazy defaultExport from "mod"; // 3. import lazy defaultExport, { export, /* ... */ } from "mod"; return (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === 'lazy' && @@ -124395,7 +124395,8 @@ var ts; // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); + var checker = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.scriptKind) === 8 /* ScriptKind.ETS */ ? getLinterTypeChecker() : getTypeChecker(); + var emitResolver = checker.getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, /*onlyBuildInfo*/ false, forceDtsEmit); @@ -124507,6 +124508,12 @@ var ts; if (ts.skipTypeChecking(sourceFile, options, program)) { return ts.emptyArray; } + if (isForLinter && sourceFile.scriptKind !== 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } + if (!isForLinter && sourceFile.scriptKind === 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } var typeChecker = isForLinter ? getLinterTypeChecker() : getTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var isJs = sourceFile.scriptKind === 1 /* ScriptKind.JS */ || sourceFile.scriptKind === 2 /* ScriptKind.JSX */; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index d65de5bf86dc645c0bf19a9b724c169e9f5ef120..261347ad1492806fd187961b092e3cca3f07f068 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -39124,7 +39124,7 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function isSetLazy(identifier) { - // 1. import lazy { export } from "mod"; + // 1. import lazy { export } from "mod"; // 2. import lazy defaultExport from "mod"; // 3. import lazy defaultExport, { export, /* ... */ } from "mod"; return (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === 'lazy' && @@ -124385,7 +124385,8 @@ var ts; // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); + var checker = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.scriptKind) === 8 /* ScriptKind.ETS */ ? getLinterTypeChecker() : getTypeChecker(); + var emitResolver = checker.getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, /*onlyBuildInfo*/ false, forceDtsEmit); @@ -124497,6 +124498,12 @@ var ts; if (ts.skipTypeChecking(sourceFile, options, program)) { return ts.emptyArray; } + if (isForLinter && sourceFile.scriptKind !== 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } + if (!isForLinter && sourceFile.scriptKind === 8 /* ScriptKind.ETS */) { + return ts.emptyArray; + } var typeChecker = isForLinter ? getLinterTypeChecker() : getTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var isJs = sourceFile.scriptKind === 1 /* ScriptKind.JS */ || sourceFile.scriptKind === 2 /* ScriptKind.JSX */; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index d512288cf1476b04adcabe98741eea2516d5275a..6dd8067c725e63173d101272ca0eb72003b9b711 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2157,7 +2157,8 @@ namespace ts { // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - const emitResolver = getTypeChecker().getEmitResolver(outFile(options) ? undefined : sourceFile, cancellationToken); + const checker = sourceFile?.scriptKind === ScriptKind.ETS ? getLinterTypeChecker() : getTypeChecker(); + const emitResolver = checker.getEmitResolver(outFile(options) ? undefined : sourceFile, cancellationToken); performance.mark("beforeEmit"); @@ -2309,6 +2310,14 @@ namespace ts { return emptyArray; } + if (isForLinter && sourceFile.scriptKind !== ScriptKind.ETS) { + return emptyArray; + } + + if (!isForLinter && sourceFile.scriptKind === ScriptKind.ETS) { + return emptyArray; + } + const typeChecker = isForLinter ? getLinterTypeChecker() : getTypeChecker(); Debug.assert(!!sourceFile.bindDiagnostics);