We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
unreachable, reachability
https://www.typescriptlang.org/play?ts=5.1.6#code/MYewdgzgLgBFAWAnEB3AWgU2TAvDAFAJS4B8MA3nEqjAAwwC+A3AFAsBmArmMFAJbgY7WkQosYEqsnRYQRVpJihIIADYYAdKpABzfAHIMADwAOGXjG6IMAQ2DwbAI3X7CrBmy49+g9gEZ8SgRpegYALgopVFoIqABPMxB2KJlsBmJycUlg6PksiWUINU1tPUNTc1grW3snFzcWDxYAE3NVG2shbl4BMBSAeTAMUQihgDcsVg5unz6delFMxRyUQeGGxULirV0DarsHZwwYGwgYYzNeDGbXd08Z3pgdPwIg6hQX8IoVv1iEjCSAyG6TEy3eAQ2ki26h2ZQulUsYGsBzqGFujTYhVgKwAKigQBFRDgyOMsLgCMRiZEVjAAEyMKZeHqCeALDL5FJ4uSQgrgIow0p7JE1Q7qE5neFXG4NJpM2YweAvQIpelfcgrWl-RLJXH4kFLbLvWl5TZ87aC8qXKrClFHdEMIA
const throwZero = () => { throw 0 }; function f0() { throwZero(); console.log('expect unreachable'); } function f1({ throw0 }: { throw0: typeof throwZero }) { throw0(); console.log('expect unreachable'); }
declare function throwOne() : never; function g0 () { throwOne(); console.log('unreachable as expected'); } function g1 ({ throw1 }: {throw1: typeof throwOne}) { throw1(); console.log('expect unreachable'); }
In first code block:
The two console.log() are not identified as unreachable code.
console.log()
In second code block:
It works at g0 declaration but not g1.
g0
g1
They should be unreachable code.
The text was updated successfully, but these errors were encountered:
Duplicate of #53510
Sorry, something went wrong.
@whzx5byb Thanks your help :D
No branches or pull requests
π Search Terms
unreachable, reachability
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.1.6#code/MYewdgzgLgBFAWAnEB3AWgU2TAvDAFAJS4B8MA3nEqjAAwwC+A3AFAsBmArmMFAJbgY7WkQosYEqsnRYQRVpJihIIADYYAdKpABzfAHIMADwAOGXjG6IMAQ2DwbAI3X7CrBmy49+g9gEZ8SgRpegYALgopVFoIqABPMxB2KJlsBmJycUlg6PksiWUINU1tPUNTc1grW3snFzcWDxYAE3NVG2shbl4BMBSAeTAMUQihgDcsVg5unz6delFMxRyUQeGGxULirV0DarsHZwwYGwgYYzNeDGbXd08Z3pgdPwIg6hQX8IoVv1iEjCSAyG6TEy3eAQ2ki26h2ZQulUsYGsBzqGFujTYhVgKwAKigQBFRDgyOMsLgCMRiZEVjAAEyMKZeHqCeALDL5FJ4uSQgrgIow0p7JE1Q7qE5neFXG4NJpM2YweAvQIpelfcgrWl-RLJXH4kFLbLvWl5TZ87aC8qXKrClFHdEMIA
π» Code
π Actual behavior
In first code block:
The two
console.log()
are not identified as unreachable code.In second code block:
It works at
g0
declaration but notg1
.π Expected behavior
They should be unreachable code.
The text was updated successfully, but these errors were encountered: