getStatementTags | Avoid unnecessary TS debugger statement invocations #180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR
Allow running tsc in debug mode when using
typescript-transform-paths
plugin.Full Explanation:
Sometimes it makes sense to run tsc in debug mode. For example in my case, we run tsc + start server in watch mode e.g.
tsc-watch --compiler ttypescript/bin/tsc --onSuccess 'npm start'
.And if we run this in a debug session like on VSCode's debug terminal, it means we run both tsc and our sever in debug mode.
The problem is that when typescript throws errors on internal assertions it's also putting a "debugger;" statement right before it throws an error.

There's a block of code in this package (typescript-transform-paths) that wraps such TS errors in a try/catch. That causes our servers to get stuck (repeatedly) on a breakpoint when debugging in watch mode.
So, I've identified the root cause of these cases, and used an if condition to prevent the TS call altogether, instead of the try/catch.
I left the try/catch though just to be on safe side, cause there might be some other cases which I've missed.
What is the case that raises the TS error?


If a NodeObject is in position -1 you can't call getFullText on it.