@@ -1560,6 +1560,7 @@ namespace ts {
1560
1560
}
1561
1561
1562
1562
function getDiagnosticsProducingTypeChecker ( ) {
1563
+ Debug . assert ( ! options . listFilesOnly || ! ! options . extendedDiagnostics ) ;
1563
1564
return diagnosticsProducingTypeChecker || ( diagnosticsProducingTypeChecker = createTypeChecker ( program , /*produceDiagnostics:*/ true ) ) ;
1564
1565
}
1565
1566
@@ -1582,11 +1583,11 @@ namespace ts {
1582
1583
function emitWorker ( program : Program , sourceFile : SourceFile | undefined , writeFileCallback : WriteFileCallback | undefined , cancellationToken : CancellationToken | undefined , emitOnlyDtsFiles ?: boolean , customTransformers ?: CustomTransformers , forceDtsEmit ?: boolean ) : EmitResult {
1583
1584
let declarationDiagnostics : readonly Diagnostic [ ] = [ ] ;
1584
1585
1585
- if ( ! forceDtsEmit ) {
1586
- if ( options . noEmit ) {
1587
- return { diagnostics : declarationDiagnostics , sourceMaps : undefined , emittedFiles : undefined , emitSkipped : true } ;
1588
- }
1586
+ if ( options . listFilesOnly || ( ! forceDtsEmit && shouldSuppressEmit ( options ) ) ) {
1587
+ return { diagnostics : declarationDiagnostics , sourceMaps : undefined , emittedFiles : undefined , emitSkipped : true } ;
1588
+ }
1589
1589
1590
+ if ( ! forceDtsEmit ) {
1590
1591
// If the noEmitOnError flag is set, then check if we have any errors so far. If so,
1591
1592
// immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we
1592
1593
// get any preEmit diagnostics, not just the ones
@@ -2036,7 +2037,9 @@ namespace ts {
2036
2037
}
2037
2038
2038
2039
function getGlobalDiagnostics ( ) : SortedReadonlyArray < Diagnostic > {
2039
- return rootNames . length ? sortAndDeduplicateDiagnostics ( getDiagnosticsProducingTypeChecker ( ) . getGlobalDiagnostics ( ) . slice ( ) ) : emptyArray as any as SortedReadonlyArray < Diagnostic > ;
2040
+ return ! options . listFilesOnly && rootNames . length
2041
+ ? sortAndDeduplicateDiagnostics ( getDiagnosticsProducingTypeChecker ( ) . getGlobalDiagnostics ( ) . slice ( ) )
2042
+ : emptyArray as any as SortedReadonlyArray < Diagnostic > ;
2040
2043
}
2041
2044
2042
2045
function getConfigFileParsingDiagnostics ( ) : readonly Diagnostic [ ] {
@@ -3089,7 +3092,7 @@ namespace ts {
3089
3092
createDiagnosticForOptionName ( Diagnostics . Option_0_cannot_be_specified_without_specifying_option_1_or_option_2 , "emitDeclarationOnly" , "declaration" , "composite" ) ;
3090
3093
}
3091
3094
3092
- if ( options . noEmit ) {
3095
+ if ( shouldSuppressEmit ( options ) ) {
3093
3096
createDiagnosticForOptionName ( Diagnostics . Option_0_cannot_be_specified_with_option_1 , "emitDeclarationOnly" , "noEmit" ) ;
3094
3097
}
3095
3098
}
@@ -3112,7 +3115,7 @@ namespace ts {
3112
3115
}
3113
3116
3114
3117
// If the emit is enabled make sure that every output file is unique and not overwriting any of the input files
3115
- if ( ! options . noEmit && ! options . suppressOutputPathCheck ) {
3118
+ if ( ! shouldSuppressEmit ( options ) && ! options . suppressOutputPathCheck ) {
3116
3119
const emitHost = getEmitHost ( ) ;
3117
3120
const emitFilesSeen = createMap < true > ( ) ;
3118
3121
forEachEmittedFile ( emitHost , ( emitFileNames ) => {
@@ -3181,7 +3184,7 @@ namespace ts {
3181
3184
}
3182
3185
3183
3186
function verifyProjectReferences ( ) {
3184
- const buildInfoPath = ! options . noEmit && ! options . suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath ( options ) : undefined ;
3187
+ const buildInfoPath = ! shouldSuppressEmit ( options ) && ! options . suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath ( options ) : undefined ;
3185
3188
forEachProjectReference ( projectReferences , resolvedProjectReferences , ( resolvedRef , index , parent ) => {
3186
3189
const ref = ( parent ? parent . commandLine . projectReferences : projectReferences ) ! [ index ] ;
3187
3190
const parentFile = parent && parent . sourceFile as JsonSourceFile ;
@@ -3322,7 +3325,7 @@ namespace ts {
3322
3325
}
3323
3326
3324
3327
function isEmittedFile ( file : string ) : boolean {
3325
- if ( options . noEmit ) {
3328
+ if ( shouldSuppressEmit ( options ) ) {
3326
3329
return false ;
3327
3330
}
3328
3331
0 commit comments