diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 5b9f4332359..2b4159644bf 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -2879,6 +2879,42 @@ namespace ts.projectSystem { const errorResult = session.executeCommand(dTsFileGetErrRequest).response; assert.isTrue(errorResult.length === 0); }); + + it("should be turned on for js-only external projects with skipLibCheck=false", () => { + const jsFile = { + path: "/a/b/file1.js", + content: "let x =1;" + }; + const dTsFile = { + path: "/a/b/file2.d.ts", + content: ` + interface T { + name: string; + }; + interface T { + name: number; + };` + }; + const host = createServerHost([jsFile, dTsFile]); + const session = createSession(host); + + const openExternalProjectRequest = makeSessionRequest( + CommandNames.OpenExternalProject, + { + projectFileName: "project1", + rootFiles: toExternalFiles([jsFile.path, dTsFile.path]), + options: { skipLibCheck: false } + } + ); + session.executeCommand(openExternalProjectRequest); + + const dTsFileGetErrRequest = makeSessionRequest( + CommandNames.SemanticDiagnosticsSync, + { file: dTsFile.path } + ); + const errorResult = session.executeCommand(dTsFileGetErrRequest).response; + assert.isTrue(errorResult.length === 0); + }); }); describe("non-existing directories listed in config file input array", () => { diff --git a/src/server/session.ts b/src/server/session.ts index b2ba3684a39..3732dae655b 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -15,14 +15,7 @@ namespace ts.server { } function shouldSkipSematicCheck(project: Project) { - if (project.getCompilerOptions().skipLibCheck !== undefined) { - return false; - } - - if ((project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) && project.isJsOnlyProject()) { - return true; - } - return false; + return (project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) && project.isJsOnlyProject(); } interface FileStart {