@@ -694,12 +694,14 @@ namespace ts {
694
694
if ( ! resolvedProjectReferences ) {
695
695
resolvedProjectReferences = projectReferences . map ( parseProjectReferenceConfigFile ) ;
696
696
}
697
- for ( const parsedRef of resolvedProjectReferences ) {
698
- if ( parsedRef ) {
699
- const out = parsedRef . commandLine . options . outFile || parsedRef . commandLine . options . out ;
700
- if ( out ) {
701
- const dtsOutfile = changeExtension ( out , ".d.ts" ) ;
702
- processSourceFile ( dtsOutfile , /*isDefaultLib*/ false , /*ignoreNoDefaultLib*/ false , /*packageId*/ undefined ) ;
697
+ if ( rootNames . length ) {
698
+ for ( const parsedRef of resolvedProjectReferences ) {
699
+ if ( parsedRef ) {
700
+ const out = parsedRef . commandLine . options . outFile || parsedRef . commandLine . options . out ;
701
+ if ( out ) {
702
+ const dtsOutfile = changeExtension ( out , ".d.ts" ) ;
703
+ processSourceFile ( dtsOutfile , /*isDefaultLib*/ false , /*ignoreNoDefaultLib*/ false , /*packageId*/ undefined ) ;
704
+ }
703
705
}
704
706
}
705
707
}
@@ -708,7 +710,7 @@ namespace ts {
708
710
forEach ( rootNames , name => processRootFile ( name , /*isDefaultLib*/ false , /*ignoreNoDefaultLib*/ false ) ) ;
709
711
710
712
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
711
- const typeReferences : string [ ] = getAutomaticTypeDirectiveNames ( options , host ) ;
713
+ const typeReferences : string [ ] = rootNames . length ? getAutomaticTypeDirectiveNames ( options , host ) : emptyArray ;
712
714
713
715
if ( typeReferences . length ) {
714
716
// This containingFilename needs to match with the one used in managed-side
@@ -724,7 +726,7 @@ namespace ts {
724
726
// - The '--noLib' flag is used.
725
727
// - A 'no-default-lib' reference comment is encountered in
726
728
// processing the root files.
727
- if ( ! skipDefaultLib ) {
729
+ if ( rootNames . length && ! skipDefaultLib ) {
728
730
// If '--lib' is not specified, include default library file according to '--target'
729
731
// otherwise, using options specified in '--lib' instead of '--target' default library file
730
732
const defaultLibraryFileName = getDefaultLibraryFileName ( ) ;
@@ -1839,7 +1841,7 @@ namespace ts {
1839
1841
}
1840
1842
1841
1843
function getGlobalDiagnostics ( ) : SortedReadonlyArray < Diagnostic > {
1842
- return sortAndDeduplicateDiagnostics ( getDiagnosticsProducingTypeChecker ( ) . getGlobalDiagnostics ( ) . slice ( ) ) ;
1844
+ return rootNames . length ? sortAndDeduplicateDiagnostics ( getDiagnosticsProducingTypeChecker ( ) . getGlobalDiagnostics ( ) . slice ( ) ) : emptyArray as any as SortedReadonlyArray < Diagnostic > ;
1843
1845
}
1844
1846
1845
1847
function getConfigFileParsingDiagnostics ( ) : ReadonlyArray < Diagnostic > {
0 commit comments