mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 20:01:02 -05:00
Suppress semantic errors in JS only configured projects
(cherry picked from commit 4ee8bdb762)
This commit is contained in:
@@ -25,8 +25,14 @@ namespace ts.server {
|
||||
return ((1e9 * seconds) + nanoseconds) / 1000000.0;
|
||||
}
|
||||
|
||||
function shouldSkipSematicCheck(project: Project) {
|
||||
return (project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) && project.isJsOnlyProject();
|
||||
function shouldSkipSemanticCheck(project: Project) {
|
||||
if (project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) {
|
||||
return project.isJsOnlyProject();
|
||||
}
|
||||
else {
|
||||
// For configured projects, require that skipLibCheck be set also
|
||||
return project.getCompilerOptions().skipLibCheck && project.isJsOnlyProject();
|
||||
}
|
||||
}
|
||||
|
||||
interface FileStart {
|
||||
@@ -447,7 +453,7 @@ namespace ts.server {
|
||||
private semanticCheck(file: NormalizedPath, project: Project) {
|
||||
try {
|
||||
let diags: Diagnostic[] = [];
|
||||
if (!shouldSkipSematicCheck(project)) {
|
||||
if (!shouldSkipSemanticCheck(project)) {
|
||||
diags = project.getLanguageService().getSemanticDiagnostics(file);
|
||||
}
|
||||
|
||||
@@ -555,7 +561,7 @@ namespace ts.server {
|
||||
|
||||
private getDiagnosticsWorker(args: protocol.FileRequestArgs, isSemantic: boolean, selector: (project: Project, file: string) => Diagnostic[], includeLinePosition: boolean) {
|
||||
const { project, file } = this.getFileAndProject(args);
|
||||
if (isSemantic && shouldSkipSematicCheck(project)) {
|
||||
if (isSemantic && shouldSkipSemanticCheck(project)) {
|
||||
return [];
|
||||
}
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
|
||||
Reference in New Issue
Block a user