Dont include auto type reference directives (#39472)

This commit is contained in:
Sheetal Nandi 2020-07-07 13:58:53 -07:00 committed by GitHub
parent b100680a3e
commit c08c059dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -282,6 +282,7 @@ namespace ts.server {
this.languageServiceEnabled = true;
if (projectService.syntaxOnly) {
this.compilerOptions.noResolve = true;
this.compilerOptions.types = [];
}
this.setInternalCompilerOptionsForEmittingJsFiles();

View File

@ -95,5 +95,19 @@ class c { prop = "hello"; foo() { return this.prop; } }`
}
assert.isTrue(hasException);
});
it("should not include auto type reference directives", () => {
const { host, session, file1 } = setup();
const atTypes: File = {
path: `/node_modules/@types/somemodule/index.d.ts`,
content: "export const something = 10;"
};
host.ensureFileOrFolder(atTypes);
const service = session.getProjectService();
openFilesForSession([file1], session);
checkNumberOfProjects(service, { inferredProjects: 1 });
const project = service.inferredProjects[0];
checkProjectActualFiles(project, [libFile.path, file1.path]); // Should not contain atTypes
});
});
}