Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect circularity detection Error 7022 #48611

Closed
zuozp8 opened this issue Apr 8, 2022 · 2 comments
Closed

Incorrect circularity detection Error 7022 #48611

zuozp8 opened this issue Apr 8, 2022 · 2 comments

Comments

@zuozp8
Copy link

zuozp8 commented Apr 8, 2022

πŸ•— Version & Regression Information

doesnt work from typescript 3.3 (oldest in playground) all the way to 4.7-nigtly

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const getBatch = async (scrollId: string | undefined): Promise<{ scroll: string; }> => {
  return { scroll : 'foofoo' }
}

let scrollId: string | undefined = undefined
for (let counter = 0; counter < 10; counter++) {
  const result = await getBatch(scrollId)
  scrollId = result.scroll
}

πŸ™ Actual behavior

i get error:

'result' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.(7022)

πŸ™‚ Expected behavior

I expect no errors: result variable should be resolved as { scroll: string; }, as function getBatch has very concrete return type

@MartinJohns
Copy link
Contributor

Duplicate of #43047 (comment).

@zuozp8
Copy link
Author

zuozp8 commented Apr 8, 2022

right, comment referenced by you talks about the same issue

@zuozp8 zuozp8 closed this as completed Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants