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
TypeScript Version: 3.9.0-dev.20200306
Search Terms: false Unreachable code detected.
false
Unreachable code detected.
Code
const foo = (_: string) => console.log; let bar: string | undefined; // ✅ bar && foo(bar) // ✅ if (false) { bar && foo(bar) ~~~~~~~~~~~~~~~ // "Unreachable code detected." } // ❌Actual false && bar && foo(bar) ~~~ // "Type 'undefined' is not assignable to type 'string'." // ✅Expected false && bar && foo(bar) ~~~~~~~~~~~~~~~ // "Unreachable code detected." // ❓No lint error false && foo('hello')
Expected behavior: false && bar && foo(bar) to note "Unreachable code detected."
false && bar && foo(bar)
Actual behavior: false && bar && foo(bar) notes "Type 'undefined' is not assignable to type 'string'."
Playground Link: https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=13&pc=1#code/MYewdgzgLgBAZiEMC8MAUB9AXDaAnASzAHMBKFAPhlEhABsBTAOjpGIG4BYAKEdgCMAhnhz4ixGAB8YAVzAATBnCIN5XbjyF4YAMh3xEaLaR48A9GZgBVMHgaDgAC0H9G1EIpiKoDYD-lMMDwEcOhwgnQQDOQA3jwwCTBauvoIIEbCJtwAvqbcFjAAgn4yETCAyAQwAEQAKgCeAA4MMADkcorKYKotMAQQMGAgsIIQEATEYC5uUEhQjc0tYiQtTFXmlgCiAB5NfqoV1TZ2Ds6uzaCe3r7+qzzhkc16ScIpBunGefdRrzQQ9MysYhoFqOBh1FqkIA
The text was updated successfully, but these errors were encountered:
The TS2345 you're getting is tracked by #26914 (note that the working case does give that error, just in a smaller error span)
I don't think I've seen an issue about diagnostics for false && /* ... */
false && /* ... */
Sorry, something went wrong.
No branches or pull requests
TypeScript Version: 3.9.0-dev.20200306
Search Terms:
false
Unreachable code detected.
Code
Expected behavior:
false && bar && foo(bar)
to note "Unreachable code detected."Actual behavior:
false && bar && foo(bar)
notes "Type 'undefined' is not assignable to type 'string'."Playground Link: https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=13&pc=1#code/MYewdgzgLgBAZiEMC8MAUB9AXDaAnASzAHMBKFAPhlEhABsBTAOjpGIG4BYAKEdgCMAhnhz4ixGAB8YAVzAATBnCIN5XbjyF4YAMh3xEaLaR48A9GZgBVMHgaDgAC0H9G1EIpiKoDYD-lMMDwEcOhwgnQQDOQA3jwwCTBauvoIIEbCJtwAvqbcFjAAgn4yETCAyAQwAEQAKgCeAA4MMADkcorKYKotMAQQMGAgsIIQEATEYC5uUEhQjc0tYiQtTFXmlgCiAB5NfqoV1TZ2Ds6uzaCe3r7+qzzhkc16ScIpBunGefdRrzQQ9MysYhoFqOBh1FqkIA
The text was updated successfully, but these errors were encountered: