Skip to content

getStatementTags | Avoid unnecessary TS debugger statement invocations #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

shlomo-artlist
Copy link
Contributor

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.
Screenshot 2023-08-27 at 16 33 41

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.
Screenshot 2023-08-27 at 16 38 36
Screenshot 2023-08-27 at 16 41 56

@shlomo-artlist shlomo-artlist changed the title getStatementTags | Avoid unnecessary ts debugger statements invocation getStatementTags | Avoid unnecessary TS debugger statement invocations Aug 27, 2023
@nonara nonara merged commit 0bb558e into LeDDGroup:master Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants