Description
assert.strictEqual(false, anyArgument)
triggers unreachable code error for any code below after the recent @types/node update. This only reproduces with @types/node
10.17.24, 12.12.41, 13.13.8 (published recently).
Note that it only reproduces with false
as a value being checked. Replace it with anything else and it will compile.
TypeScript Version: 3.9.3, 3.8.x as well
Search Terms: strictEqual
error TS7027: Unreachable code detected
Code
import * as assert from 'assert';
const b = false;
assert.strictEqual(false, b);
console.log('really unreachable?');
Expected behavior: should compile with --allowUnreachableCode false
.
Actual behavior:
$ npx tsc --allowUnreachableCode false src/index.ts
src/index.ts:5:1 - error TS7027: Unreachable code detected.
5 console.log('really unreachable?');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error.
Playground Link: N/A because of the specific version of @types/node
required for a repro.
Related Issues: N/A
Background: Here is the commit in @types/node
that apparently triggers this: DefinitelyTyped/DefinitelyTyped@e910379
I reported it there as well in DefinitelyTyped/DefinitelyTyped#44944, but I have an impression the compiler behaves weirdly here.