Skip to content

Commit f5157ef

Browse files
Zhengbo LiZhengbo Li
Zhengbo Li
authored and
Zhengbo Li
committed
Turn on noEmit for inferred / external projects without ts files
1 parent ad9c148 commit f5157ef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/server/project.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,14 @@ namespace ts.server {
471471
// - newProgram is different from the old program and structure of the old program was not reused.
472472
if (!oldProgram || (this.program !== oldProgram && !oldProgram.structureIsReused)) {
473473
hasChanges = true;
474+
475+
const options = this.getCompilerOptions();
476+
if ((this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) && !options.noEmit && allFilesAreJsOrDts(this)) {
477+
options.noEmit = true;
478+
// need to get a new program as the compiler option changed.
479+
this.program = this.languageService.getProgram();
480+
}
481+
474482
if (oldProgram) {
475483
for (const f of oldProgram.getSourceFiles()) {
476484
if (this.program.getSourceFileByPath(f.path)) {

0 commit comments

Comments
 (0)