-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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.
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.
- I tried using the
@types/xxxxpackage and had problems. - I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
- I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
- Mention the authors (see
Definitions by:inindex.d.ts) so they can respond.- Authors: @G-Rath as a commit author