@@ -16,7 +16,7 @@ import ts = require("typescript");
1616export function compile ( fileNames : string [ ] , options : ts . CompilerOptions ) : void {
1717 var host = ts . createCompilerHost ( options ) ;
1818 var program = ts . createProgram ( fileNames , options , host ) ;
19- var result = program . emitFiles ( ) ;
19+ var result = program . emit ( ) ;
2020
2121 var allDiagnostics = program . getDiagnostics ( )
2222 . concat ( program . getTypeCheckerDiagnostics ( ) )
@@ -737,19 +737,31 @@ declare module "typescript" {
737737 getSourceFile ( fileName : string ) : SourceFile ;
738738 getCurrentDirectory ( ) : string ;
739739 }
740+ interface WriteFileCallback {
741+ ( fileName : string , data : string , writeByteOrderMark : boolean , onError ?: ( message : string ) => void ) : void ;
742+ }
740743 interface Program extends ScriptReferenceHost {
741744 getSourceFiles ( ) : SourceFile [ ] ;
742745 getCompilerHost ( ) : CompilerHost ;
743- getEmitResolver ( ) : EmitResolver ;
746+ /**
747+ * Emits the javascript and declaration files. If targetSourceFile is not specified, then
748+ * the javascript and declaration files will be produced for all the files in this program.
749+ * If targetSourceFile is specified, then only the javascript and declaration for that
750+ * specific file will be generated.
751+ *
752+ * If writeFile is not specified then the writeFile callback from getCompilerHost() will be
753+ * used for writing the javascript and declaration files. Otherwise, the writeFile parameter
754+ * will be invoked when writing the javascript and declaration files.
755+ */
756+ emit ( targetSourceFile ? : SourceFile , writeFile ? : WriteFileCallback ) : EmitResult ;
757+ isEmitBlocked ( sourceFile ? : SourceFile ) : boolean ;
744758 getTypeCheckerDiagnostics ( sourceFile ? : SourceFile ) : Diagnostic [ ] ;
745759 getTypeCheckerGlobalDiagnostics ( ) : Diagnostic [ ] ;
746760 getDiagnostics ( sourceFile ? : SourceFile ) : Diagnostic [ ] ;
747761 getGlobalDiagnostics ( ) : Diagnostic [ ] ;
748762 getDeclarationDiagnostics ( sourceFile : SourceFile ) : Diagnostic [ ] ;
749763 getTypeChecker ( ) : TypeChecker ;
750764 getCommonSourceDirectory ( ) : string ;
751- emitFiles ( targetSourceFile ? : SourceFile ) : EmitResult ;
752- isEmitBlocked ( sourceFile ? : SourceFile ) : boolean ;
753765 }
754766 interface SourceMapSpan {
755767 emittedLine : number ;
@@ -1338,7 +1350,7 @@ declare module "typescript" {
13381350 getSourceFile ( fileName : string , languageVersion : ScriptTarget , onError ?: ( message : string ) => void ) : SourceFile ;
13391351 getDefaultLibFileName ( options : CompilerOptions ) : string ;
13401352 getCancellationToken ?( ) : CancellationToken ;
1341- writeFile ( fileName : string , data : string , writeByteOrderMark : boolean , onError ?: ( message : string ) => void ) : void ;
1353+ writeFile : WriteFileCallback ;
13421354 getCurrentDirectory ( ) : string ;
13431355 getCanonicalFileName ( fileName : string ) : string ;
13441356 useCaseSensitiveFileNames ( ) : boolean ;
@@ -1916,7 +1928,7 @@ var ts = require("typescript");
19161928function compile ( fileNames , options ) {
19171929 var host = ts . createCompilerHost ( options ) ;
19181930 var program = ts . createProgram ( fileNames , options , host ) ;
1919- var result = program . emitFiles ( ) ;
1931+ var result = program . emit ( ) ;
19201932 var allDiagnostics = program . getDiagnostics ( ) . concat ( program . getTypeCheckerDiagnostics ( ) ) . concat ( result . diagnostics ) ;
19211933 allDiagnostics . forEach ( function ( diagnostic ) {
19221934 var lineChar = diagnostic . file . getLineAndCharacterFromPosition ( diagnostic . start ) ;
0 commit comments