Not getting "Unreachable code" error in: a = true; if (a) { throw; }; console.log(a);
See original GitHub issueWhat should happen:
What does happen: (no error)
I also tried adding as const
, still no error:
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Warning: unreachable code after return statement - JavaScript
When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is...
Read more >Throwing temporary exceptions without "unreachable code ...
The problem is I have warnings set as errors, so compilation will fail with a CS0162 Unreachable code detected, since "Some more code"...
Read more >no-unreachable - ESLint - Pluggable JavaScript Linter
This rule disallows unreachable code after return , throw , continue , and break statements. This rule also flags definitions of instance fields...
Read more >Unreachable Code Error in Java - GeeksforGeeks
The Unreachable statements refers to statements that won't get executed during the execution of the program are called Unreachable ...
Read more >unreachable code no-unreachable when throw new error ...
no -unreachable is just a warning that tells you that you have unreachable code in your code. In this case, it is the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why are you writing code like this?
I see. Anyway, unreachability errors only occur for syntactically-unreachable positions. We don’t do reachability based on types because it prevents you from writing defensive code