-
Couldn't load subscription status.
- Fork 13.1k
Closed
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this
Milestone
Description
TypeScript Version: 3.6.0-dev.20190724
Search Terms:
Compiler API, createWatchCompilerHost, watch Diagnostic
Code
const host = ts.createWatchCompilerHost(
'C://path/to/my/tsconfig.json',
{},
ts.sys,
ts.createEmitAndSemanticDiagnosticsBuilderProgram,
() => {},
handleWatchStatusChanged,
);
function handleWatchStatusChanged( diagnostic: Diagnostic )
{
switch ( diagnostic.code )
{
case 6031: // Initial build
case 6032: // Incremental build
console.log( 'Building...' );
case 6193: // 1 Error
console.log( 'Build Failure. There was 1 error while building.' );
case 6194: // 0 errors or 2+ errors
console.log( 'Maybe success?' );
}Expected behavior:
The watch status changed diagnostic.code would differentiate between a successful build and a build with errors.
Actual behavior:
Currently diagnostic.code can differentiate between:
- There was one single error with the build.
- There were either no errors or more than one error.
It looks like this code in watch.ts is where the explict errorCount === 1 check happens.
dsherret, okep and tamj0rd2
Metadata
Metadata
Assignees
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this