Skip to content

--watch triggers --noUnusedLocals false positives #21518

@jwbay

Description

@jwbay

TypeScript Version: 2.7.1

Search Terms:
watch mode, unusedlocals, declared but never read

Code

Run tsc --watch with this:

function one() {}

function two() {
  return function three() {
    one();
  }
}

Then change it to this:

function one() {}

// export added
export function two() {
  return function three() {
    one();
  }
}

Expected behavior:
No errors introduced

Actual behavior:

test.tsx(1,10): error TS6133: 'one' is declared but its value is never read.
17:32:24 - Compilation complete. Watching for file changes.

In a larger project, I saw this just from running tsc --watch, didn't need to make a change to trigger it.

This doesn't show up when running tsc without watch, and no errors show up in VSCode either.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions