File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3067,12 +3067,15 @@ namespace ts.projectSystem {
30673067 const projectService = createProjectService ( host ) ;
30683068 projectService . openClientFile ( file1 . path ) ;
30693069
3070- const project = projectService . inferredProjects [ 0 ] ;
3071- const sourceFileForFile1 = project . getSourceFile ( < Path > file1 . path ) ;
3072- const sourceFileForModuleFile = project . getSourceFile ( < Path > moduleFile . path ) ;
3073-
3074- assert . isNotNull ( sourceFileForFile1 ) ;
3075- assert . isNotNull ( sourceFileForModuleFile ) ;
3070+ let project = projectService . inferredProjects [ 0 ] ;
3071+ let options = project . getCompilerOptions ( ) ;
3072+ assert . isTrue ( options . maxNodeModuleJsDepth === 2 ) ;
3073+
3074+ // Assert the option sticks
3075+ projectService . setCompilerOptionsForInferredProjects ( { target : ScriptTarget . ES2016 } ) ;
3076+ project = projectService . inferredProjects [ 0 ] ;
3077+ options = project . getCompilerOptions ( ) ;
3078+ assert . isTrue ( options . maxNodeModuleJsDepth === 2 ) ;
30763079 } ) ;
30773080 } ) ;
30783081
Original file line number Diff line number Diff line change @@ -1073,7 +1073,7 @@ namespace ts.server {
10731073 : new InferredProject ( this , this . documentRegistry , this . compilerOptionsForInferredProjects ) ;
10741074
10751075 if ( root . scriptKind === ScriptKind . JS || root . scriptKind === ScriptKind . JSX ) {
1076- project . isJsInferredProject = true ;
1076+ project . setAsJsInferredProject ( ) ;
10771077 }
10781078
10791079 project . addRoot ( root ) ;
Original file line number Diff line number Diff line change @@ -713,14 +713,14 @@ namespace ts.server {
713713 } ) ( ) ;
714714
715715 private _isJsInferredProject = false ;
716- set isJsInferredProject ( newValue : boolean ) {
717- if ( newValue && ! this . _isJsInferredProject ) {
718- this . setCompilerOptions ( this . getCompilerOptions ( ) ) ;
719- }
720- this . _isJsInferredProject = newValue ;
716+
717+ setAsJsInferredProject ( ) {
718+ this . _isJsInferredProject = true ;
719+ this . setCompilerOptions ( ) ;
721720 }
722721
723- setCompilerOptions ( newOptions : CompilerOptions ) {
722+ setCompilerOptions ( newOptions ?: CompilerOptions ) {
723+ newOptions = newOptions ? newOptions : this . getCompilerOptions ( ) ;
724724 if ( ! newOptions ) {
725725 return ;
726726 }
You can’t perform that action at this time.
0 commit comments