Skip to content

Commit c08c059

Browse files
authored
Dont include auto type reference directives (microsoft#39472)
1 parent b100680 commit c08c059

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/server/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ namespace ts.server {
282282
this.languageServiceEnabled = true;
283283
if (projectService.syntaxOnly) {
284284
this.compilerOptions.noResolve = true;
285+
this.compilerOptions.types = [];
285286
}
286287

287288
this.setInternalCompilerOptionsForEmittingJsFiles();

src/testRunner/unittests/tsserver/semanticOperationsOnSyntaxServer.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,19 @@ class c { prop = "hello"; foo() { return this.prop; } }`
9595
}
9696
assert.isTrue(hasException);
9797
});
98+
99+
it("should not include auto type reference directives", () => {
100+
const { host, session, file1 } = setup();
101+
const atTypes: File = {
102+
path: `/node_modules/@types/somemodule/index.d.ts`,
103+
content: "export const something = 10;"
104+
};
105+
host.ensureFileOrFolder(atTypes);
106+
const service = session.getProjectService();
107+
openFilesForSession([file1], session);
108+
checkNumberOfProjects(service, { inferredProjects: 1 });
109+
const project = service.inferredProjects[0];
110+
checkProjectActualFiles(project, [libFile.path, file1.path]); // Should not contain atTypes
111+
});
98112
});
99113
}

0 commit comments

Comments
 (0)