File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -609,9 +609,18 @@ namespace ts {
609609 // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we
610610 // get any preEmit diagnostics, not just the ones
611611 if ( options . noEmitOnError ) {
612- const preEmitDiagnostics = getPreEmitDiagnostics ( program , /*sourceFile:*/ undefined , cancellationToken ) ;
613- if ( preEmitDiagnostics . length > 0 ) {
614- return { diagnostics : preEmitDiagnostics , sourceMaps : undefined , emitSkipped : true } ;
612+ const diagnostics = program . getOptionsDiagnostics ( cancellationToken ) . concat (
613+ program . getSyntacticDiagnostics ( sourceFile , cancellationToken ) ,
614+ program . getGlobalDiagnostics ( cancellationToken ) ,
615+ program . getSemanticDiagnostics ( sourceFile , cancellationToken ) ) ;
616+ let declarationDiagnostics : Diagnostic [ ] = [ ] ;
617+
618+ if ( diagnostics . length === 0 && program . getCompilerOptions ( ) . declaration ) {
619+ declarationDiagnostics = program . getDeclarationDiagnostics ( /*sourceFile*/ undefined , cancellationToken ) ;
620+ }
621+
622+ if ( diagnostics . length > 0 || declarationDiagnostics . length > 0 ) {
623+ return { diagnostics : declarationDiagnostics , sourceMaps : undefined , emitSkipped : true } ;
615624 }
616625 }
617626
You can’t perform that action at this time.
0 commit comments