Merge pull request #14716 from Microsoft/fix14565

Do not report semantic diagnostics for infered and external projects with only .js files
This commit is contained in:
Mohamed Hegazy 2017-03-20 10:45:46 -07:00 committed by GitHub
commit 238edf08b7
2 changed files with 37 additions and 8 deletions

View File

@ -3006,6 +3006,42 @@ namespace ts.projectSystem {
const errorResult = <protocol.Diagnostic[]>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<protocol.OpenExternalProjectArgs>(
CommandNames.OpenExternalProject,
{
projectFileName: "project1",
rootFiles: toExternalFiles([jsFile.path, dTsFile.path]),
options: { skipLibCheck: false }
}
);
session.executeCommand(openExternalProjectRequest);
const dTsFileGetErrRequest = makeSessionRequest<protocol.SemanticDiagnosticsSyncRequestArgs>(
CommandNames.SemanticDiagnosticsSync,
{ file: dTsFile.path }
);
const errorResult = <protocol.Diagnostic[]>session.executeCommand(dTsFileGetErrRequest).response;
assert.isTrue(errorResult.length === 0);
});
});
describe("non-existing directories listed in config file input array", () => {

View File

@ -26,14 +26,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 {