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
interfaceState{}declarefunctioninitialState(): State|nulldeclarefunctionnextState(state: State|null): [State]|undefinedexportfunctionbar(): void{letstate=initialState()if(state==null)returnfor(;;){const[next]: [State]|[]=nextState(state)??[]// ~~~~ 'next' implicitly has type 'any' because it does not have a// type annotation and is referenced directly or indirectly in its own initializer.state=next!}}
Bug Report
π Search Terms
variable declaration equals implicit any loop
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
Originally reported in: typescript-eslint/typescript-eslint#2248
π Actual behavior
If you remove
state = next!
or thefor (;;)
, the code exhibits the expected behavior.π Expected behavior
next
is inferred to be typeState | undefined
.The text was updated successfully, but these errors were encountered: