docs/libs/typescript.js
function writeReferencePath(referencedFile, addBundledFileReference, emitOnlyDtsFiles) {
            var declFileName;
            var addedBundledEmitReference = false;
            if (ts.isDeclarationFile(referencedFile)) {
                // Declaration file, use declaration file name
                declFileName = referencedFile.fileName;
            }
            else {
                // Get the declaration file path
                ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles);
            }
            if (declFileName) {
                declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, 
                /*isAbsolutePathAnUrl*/ false);
                referencesOutput += "/// <reference path=\"" + declFileName + "\" />" + newLine;
            }
            return addedBundledEmitReference;
            function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) {
                // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path
                if (isBundledEmit && !addBundledFileReference) {
                    return;
                }
                ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files");
                declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath;
                addedBundledEmitReference = isBundledEmit;
            }
        }
function writeReferencePath(referencedFile, addBundledFileReference, emitOnlyDtsFiles) {
            var declFileName;
            var addedBundledEmitReference = false;
            if (ts.isDeclarationFile(referencedFile)) {
                // Declaration file, use declaration file name
                declFileName = referencedFile.fileName;
            }
            else {
                // Get the declaration file path
                ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles);
            }
            if (declFileName) {
                declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, 
                /*isAbsolutePathAnUrl*/ false);
                referencesOutput += "/// <reference path=\"" + declFileName + "\" />" + newLine;
            }
            return addedBundledEmitReference;
            function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) {
                // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path
                if (isBundledEmit && !addBundledFileReference) {
                    return;
                }
                ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files");
                declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath;
                addedBundledEmitReference = isBundledEmit;
            }
        }
function writeReferencePath ( referencedFile , addBundledFileReference , emitOnlyDtsFiles ) { var declFileName ; var addedBundledEmitReference = false ; if ( ts . isDeclarationFile ( referencedFile ) ) { // Declaration file, use declaration file name declFileName = referencedFile . fileName ; } else { // Get the declaration file path ts . forEachExpectedEmitFile ( host , getDeclFileName , referencedFile , emitOnlyDtsFiles ) ; } if ( declFileName ) { declFileName = ts . getRelativePathToDirectoryOrUrl ( ts . getDirectoryPath ( ts . normalizeSlashes ( declarationFilePath ) ) , declFileName , host . getCurrentDirectory ( ) , host . getCanonicalFileName , /*isAbsolutePathAnUrl*/ false ) ; referencesOutput += "/// <reference path=\"" + declFileName + "\" />" + newLine ; } return addedBundledEmitReference ; function getDeclFileName ( emitFileNames , sourceFiles , isBundledEmit ) { // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path if ( isBundledEmit && ! addBundledFileReference ) { return ; } ts . Debug . assert ( ! ! emitFileNames . declarationFilePath || ts . isSourceFileJavaScript ( referencedFile ) , "Declaration file is not present only for javascript files" ) ; declFileName = emitFileNames . declarationFilePath || emitFileNames . jsFilePath ; addedBundledEmitReference = isBundledEmit ; } }
Adds the reference to referenced file, returns true if global file reference was emitted
@param referencedFile
@param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not
Adds the reference to referenced file returns true if global file reference was emitted