-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.7.2
Search Terms: 7022, referenced directly or indirectly in its own initializer
Code
let items: string[] | null = null;
items = items || [];
for (const row of []) {
const item = items.find(() => true); // ERROR
const result = item ? true: false // ERROR
switch (result) {
}
}Expected behavior:
No error & warnings.
const item: string | undefined
const result: boolean
Actual behavior:
'item' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.(7022)
'result' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.(7022)
const item: any
const result: any
Playground Link: Link
It works in 3.6.3 and fails in 3.7.2.
Related Issues:
I think this is not related to #33191 since this introduced after 3.6.3.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue