docs/libs/typescript.js
function getArgumentIndexForTemplatePiece(spanIndex, node, position) {
            // Because the TemplateStringsArray is the first argument, we have to offset each substitution expression by 1.
            // There are three cases we can encounter:
            //      1. We are precisely in the template literal (argIndex = 0).
            //      2. We are in or to the right of the substitution expression (argIndex = spanIndex + 1).
            //      3. We are directly to the right of the template literal, but because we look for the token on the left,
            //          not enough to put us in the substitution expression; we should consider ourselves part of
            //          the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1).
            //
            // Example: f  `# abcd $#{#  1 + 1#  }# efghi ${ #"#hello"#  }  #  `
            //              ^       ^ ^       ^   ^          ^ ^      ^     ^
            // Case:        1       1 3       2   1          3 2      2     1
            ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
            if (ts.isTemplateLiteralKind(node.kind)) {
                if (ts.isInsideTemplateLiteral(node, position)) {
                    return 0;
                }
                return spanIndex + 2;
            }
            return spanIndex + 1;
        }
function getArgumentIndexForTemplatePiece(spanIndex, node, position) {
            // Because the TemplateStringsArray is the first argument, we have to offset each substitution expression by 1.
            // There are three cases we can encounter:
            //      1. We are precisely in the template literal (argIndex = 0).
            //      2. We are in or to the right of the substitution expression (argIndex = spanIndex + 1).
            //      3. We are directly to the right of the template literal, but because we look for the token on the left,
            //          not enough to put us in the substitution expression; we should consider ourselves part of
            //          the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1).
            //
            // Example: f  `# abcd $#{#  1 + 1#  }# efghi ${ #"#hello"#  }  #  `
            //              ^       ^ ^       ^   ^          ^ ^      ^     ^
            // Case:        1       1 3       2   1          3 2      2     1
            ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
            if (ts.isTemplateLiteralKind(node.kind)) {
                if (ts.isInsideTemplateLiteral(node, position)) {
                    return 0;
                }
                return spanIndex + 2;
            }
            return spanIndex + 1;
        }
function getArgumentIndexForTemplatePiece ( spanIndex , node , position ) { // Because the TemplateStringsArray is the first argument, we have to offset each substitution expression by 1. // There are three cases we can encounter: //      1. We are precisely in the template literal (argIndex = 0). //      2. We are in or to the right of the substitution expression (argIndex = spanIndex + 1). //      3. We are directly to the right of the template literal, but because we look for the token on the left, //          not enough to put us in the substitution expression; we should consider ourselves part of //          the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // // Example: f  `# abcd $#{#  1 + 1#  }# efghi ${ #"#hello"#  }  #  ` //              ^       ^ ^       ^   ^          ^ ^      ^     ^ // Case:        1       1 3       2   1          3 2      2     1 ts . Debug . assert ( position >= node . getStart ( ) , "Assumed 'position' could not occur before node." ) ; if ( ts . isTemplateLiteralKind ( node . kind ) ) { if ( ts . isInsideTemplateLiteral ( node , position ) ) { return 0 ; } return spanIndex + 2 ; } return spanIndex + 1 ; }
spanIndex is either the index for a given template span. This does not give appropriate results for a NoSubstitutionTemplateLiteral
spanIndex is either the index for a given template span . This does not give appropriate results for a NoSubstitutionTemplateLiteral