-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Description
Description:
I'm encountering an issue where TypeScript reports that the variable toDate is declared but its value is never read (Error Code 6133). However, the variable toDate is actually used, so this seems to be a false positive in TypeScript's analysis.
Steps to Reproduce:
-
Use the following TypeScript code:
function foo() { let toDate = moment().startOf('day'); if (true) { toDate = moment(new Date(this.datePicker.fromDate)).endOf('day'); } }
-
The TypeScript compiler will raise the error:
'toDate' is declared but its value is never read. (6133)
Expected Behavior:
TypeScript should recognize that toDate is assigned a new value within the if block, and it should not report it as "unused."
Actual Behavior:
TypeScript reports that toDate is declared but never used, even though the variable is reassigned in the if block.
Metadata
Metadata
Assignees
Labels
No labels