FYI
I seems I hit a but where apparently UXP is optimizing out a variable that is being used.
( Note: fileToTranscriptLUT has been defined as a Map() and initialized prior to the call)
This fails (“transcript” is unassigned, and “unassigned” is passed to the function)
if (start.indexOf("+") > 0) {
const transcript = fileToTranscriptLUT.get(sourceFile)
[start, end] = getStartAndEnd(text, start.slice(0,-1), end, transcript)
}
… but this works fine (value associated with sourceFile is returned as expected and passed to the function):
if (start.indexOf("+") > 0) {
const transcript = fileToTranscriptLUT.get(sourceFile)
typeof(transcript); // looks useless but needed to work around bug
[start, end] = getStartAndEnd(text, start.slice(0,-1), end, transcript)
}
It seems like the engine is trying to optimize the variable transcript out (despite being passed to function just below).
The extra line using the variable as well (typeof(transcript)) to prevent the engine from optimizing it out (it worked as well when I was logging the variable logWarning(transcript) instead of that line).