diff --git a/src/server/project.ts b/src/server/project.ts index d6fb86425de..cf4167040cc 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1077,7 +1077,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo } protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition): TypeAcquisition { - if (!newTypeAcquisition || !newTypeAcquisition.include) { + if (!newTypeAcquisition.enable || !newTypeAcquisition.include) { // Nothing to filter out, so just return as-is return newTypeAcquisition; } @@ -1627,8 +1627,9 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo } protected removeExistingTypings(include: string[]): string[] { + if (!include.length) return include; const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this.directoryStructureHost); - return include.filter(i => !existing.includes(i)); + return filter(include, i => !existing.includes(i)); } private updateGraphWorker() {