Skip to content

Commit 25d8367

Browse files
committed
Suppress semantic errors in JS only configured projects
(cherry picked from commit 4ee8bdb)
1 parent a9d8df2 commit 25d8367

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/server/session.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ namespace ts.server {
2525
return ((1e9 * seconds) + nanoseconds) / 1000000.0;
2626
}
2727

28-
function shouldSkipSematicCheck(project: Project) {
29-
return (project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) && project.isJsOnlyProject();
28+
function shouldSkipSemanticCheck(project: Project) {
29+
if (project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) {
30+
return project.isJsOnlyProject();
31+
}
32+
else {
33+
// For configured projects, require that skipLibCheck be set also
34+
return project.getCompilerOptions().skipLibCheck && project.isJsOnlyProject();
35+
}
3036
}
3137

3238
interface FileStart {
@@ -447,7 +453,7 @@ namespace ts.server {
447453
private semanticCheck(file: NormalizedPath, project: Project) {
448454
try {
449455
let diags: Diagnostic[] = [];
450-
if (!shouldSkipSematicCheck(project)) {
456+
if (!shouldSkipSemanticCheck(project)) {
451457
diags = project.getLanguageService().getSemanticDiagnostics(file);
452458
}
453459

@@ -555,7 +561,7 @@ namespace ts.server {
555561

556562
private getDiagnosticsWorker(args: protocol.FileRequestArgs, isSemantic: boolean, selector: (project: Project, file: string) => Diagnostic[], includeLinePosition: boolean) {
557563
const { project, file } = this.getFileAndProject(args);
558-
if (isSemantic && shouldSkipSematicCheck(project)) {
564+
if (isSemantic && shouldSkipSemanticCheck(project)) {
559565
return [];
560566
}
561567
const scriptInfo = project.getScriptInfoForNormalizedPath(file);

0 commit comments

Comments
 (0)