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.
This looks to me like a tsc problem rather than types problem (I reported it in microsoft/TypeScript#38699) but the fastest fix would be rolling back the @types/node changes, so I'm duplicating the issue here as well.
TypeScript Version: 3.9.3, also reproduces on 3.8.x
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.
This looks to be directly caused by recent releases of @types/node with this commit e910379 included.
assert.strictEqual(false, anyArgument)triggers unreachable code error for any code below after the recent @types/node update. This only reproduces with@types/node10.17.24, 12.12.41, 13.13.8 (published recently).Note that it only reproduces with
falseas a value being checked. Replace it with anything else and it will compile.This looks to me like a
tscproblem rather than types problem (I reported it in microsoft/TypeScript#38699) but the fastest fix would be rolling back the@types/nodechanges, so I'm duplicating the issue here as well.TypeScript Version: 3.9.3, also reproduces on 3.8.x
Code
Expected behavior: should compile with
--allowUnreachableCode false.Actual behavior:
This looks to be directly caused by recent releases of
@types/nodewith this commit e910379 included.@types/xxxxpackage and had problems.Definitions by:inindex.d.ts) so they can respond.