File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
testRunner/unittests/tsserver
tests/baselines/reference/api Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -706,10 +706,10 @@ namespace ts.server {
706
706
return this . projectName ;
707
707
}
708
708
709
- protected removeLocalTypingsFromTypeAcquisition ( newTypeAcquisition : TypeAcquisition | undefined ) : TypeAcquisition {
709
+ protected removeLocalTypingsFromTypeAcquisition ( newTypeAcquisition : TypeAcquisition ) : TypeAcquisition {
710
710
if ( ! newTypeAcquisition || ! newTypeAcquisition . include ) {
711
711
// Nothing to filter out, so just return as-is
712
- return newTypeAcquisition || { } ;
712
+ return newTypeAcquisition ;
713
713
}
714
714
return { ...newTypeAcquisition , include : this . removeExistingTypings ( newTypeAcquisition . include ) } ;
715
715
}
@@ -1410,7 +1410,9 @@ namespace ts.server {
1410
1410
}
1411
1411
1412
1412
setTypeAcquisition ( newTypeAcquisition : TypeAcquisition | undefined ) : void {
1413
- this . typeAcquisition = this . removeLocalTypingsFromTypeAcquisition ( newTypeAcquisition ) ;
1413
+ if ( newTypeAcquisition ) {
1414
+ this . typeAcquisition = this . removeLocalTypingsFromTypeAcquisition ( newTypeAcquisition ) ;
1415
+ }
1414
1416
}
1415
1417
1416
1418
getTypeAcquisition ( ) {
Original file line number Diff line number Diff line change @@ -429,5 +429,26 @@ namespace ts.projectSystem {
429
429
configuredRemoved . clear ( ) ;
430
430
}
431
431
} ) ;
432
+
433
+ it ( "regression test - should infer typeAcquisition for inferred projects when set undefined" , ( ) => {
434
+ const file1 = { path : "/a/file1.js" , content : "" } ;
435
+ const host = createServerHost ( [ file1 ] ) ;
436
+
437
+ const projectService = createProjectService ( host ) ;
438
+
439
+ projectService . openClientFile ( file1 . path ) ;
440
+
441
+ checkNumberOfProjects ( projectService , { inferredProjects : 1 } ) ;
442
+ const inferredProject = projectService . inferredProjects [ 0 ] ;
443
+ checkProjectActualFiles ( inferredProject , [ file1 . path ] ) ;
444
+ inferredProject . setTypeAcquisition ( undefined ) ;
445
+
446
+ const expected = {
447
+ enable : true ,
448
+ include : [ ] ,
449
+ exclude : [ ]
450
+ } ;
451
+ assert . deepEqual ( inferredProject . getTypeAcquisition ( ) , expected , "typeAcquisition should be inferred for inferred projects" ) ;
452
+ } ) ;
432
453
} ) ;
433
454
}
Original file line number Diff line number Diff line change @@ -9307,7 +9307,7 @@ declare namespace ts.server {
9307
9307
enableLanguageService(): void;
9308
9308
disableLanguageService(lastFileExceededProgramSize?: string): void;
9309
9309
getProjectName(): string;
9310
- protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined ): TypeAcquisition;
9310
+ protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition): TypeAcquisition;
9311
9311
getExternalFiles(): SortedReadonlyArray<string>;
9312
9312
getSourceFile(path: Path): SourceFile | undefined;
9313
9313
close(): void;
You can’t perform that action at this time.
0 commit comments