You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Argument of type 'false' is not assignable to parameter of type 'true'. In this case, that means that bool is narrowed to false on line 8.
π Expected behavior
The type of bool should be boolean because it will be true if the timer on line 5 ran and false if it did not. (In practice, with this exact code snippet, it is always true, so it definitely should not be narrowed to false!)
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
"no-unnecessary-condition", "boolean", "constant", "mutated", "conditional", "timer"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.9.0-dev.20250318&ssl=9&ssc=1&pln=1&pc=1#code/KYDwDg9gTgLgBDAnmYcCSBnAoiAhgYxgB4AVAGjgFUA+OAXjgG0SBdOUGYAOwBMMnKbAPxwAFI0HsQnXv2bCEUAK6oAXHABmuADYZgASjjqtu4AG4AUKEixNSroQCWELnFwY9sEsmCkpMvkUVOAAfTR09alEAfXUSQwBvAF8LC21geAAjCAhtenDTSz0YEkcAW2AIJRhRUUM6WgS4bNz8mGVzOCSKAEZ9SwtcAHdcR3guYCG4AAUoCDLHPVEoYAxcgDdUBrhi0oqqmrr6WhW17U3Rex5gDUcJnn1egAYn-X7Bj2AvHyJMHAJiEgUBANM0ctoKCZIlEoQZLEA
π» Code
π Actual behavior
Argument of type 'false' is not assignable to parameter of type 'true'.
In this case, that means thatbool
is narrowed tofalse
on line 8.π Expected behavior
The type of
bool
should beboolean
because it will betrue
if the timer on line 5 ran andfalse
if it did not. (In practice, with this exact code snippet, it is alwaystrue
, so it definitely should not be narrowed tofalse
!)Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: