Apparently, since 2.9.1, unreachable code is allowed by default, you have to explicitly set allowUnreachableCode to false in tsconfig.json to get the old behavior.
This doesn't match what's described in the docs.

Quick repro :
package.json
{
"name": "tmp",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"typescript": "2.9.1"
}
}
tsconfig.json (default from tsc --init)
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true
}
}
index.ts
export const a = (): boolean => {
return true;
return false;
};
yarn tsc outputs no warning as of 2.9.1
See #24320
The docs on --allowUnreachableCode just cost me half an hour; I hope that PR hasn't stalled, for the sake of others.
The documentation is still wrong. When the compiler is called in command line mode, unreachable code is not reported at the console unless allowUnreachableCode is explicitly set to false.
see #24261
A note for Visual Studio (vscode) users: it appears that when vscode analyzes TypeScript code, and allowUnreachableCode is unset in tsconfig.json, it follows the documented behavior and assumes the default is false. This can lead you to a bad time when your command-line compiler and Visual Studio disagree on whether unreachable code is allowed.
Picking a value and setting it in tsconfig.json appears to fix the issue.
Most helpful comment
The documentation is still wrong. When the compiler is called in command line mode, unreachable code is not reported at the console unless
allowUnreachableCodeis explicitly set tofalse.see #24261