code: function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) {
          var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles);
          var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit;
          if (!emitSkipped) {
              var declarationOutput = emitDeclarationResult.referencesOutput
                  + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);
              ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles);
          }
          return emitSkipped;
          function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) {
              var appliedSyncOutputPos = 0;
              var declarationOutput = "";
              // apply asynchronous additions to the synchronous output
              ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {
                  if (aliasEmitInfo.asynchronousOutput) {
                      declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);
                      declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo);
                      appliedSyncOutputPos = aliasEmitInfo.outputPos;
                  }
              });
              declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);
              return declarationOutput;
          }
      }
docs: /* @internal