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

Array.fromAsync type define on its mapFn missing the index as second argument #59836

Closed
imcotton opened this issue Sep 3, 2024 · 0 comments · Fixed by #59837
Closed

Array.fromAsync type define on its mapFn missing the index as second argument #59836

imcotton opened this issue Sep 3, 2024 · 0 comments · Fixed by #59837
Labels
Bug A bug in TypeScript
Milestone

Comments

@imcotton
Copy link
Contributor

imcotton commented Sep 3, 2024

🔎 Search Terms

fromAsync index

🕗 Version & Regression Information

  • This changed between versions 5.4 and 5.5
  • This changed in commit or PR add Array.fromAsync to esnext #57748
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about Array.fromAsync
  • I was unable to test this on prior versions because it only introduced in 5.4

⏯ Playground Link

https://www.typescriptlang.org/play/?target=99&jsx=0&module=0&ts=5.5.4#code/IIJxEME8DoDMQPYFtgGdIDsDGAKA2gAQDk4RANMQEZEEC6FOqALiBQJYYAmApgB4CUBALwA+AjgDeBDj14VmIAgF9+-ANxA

💻 Code

Array.fromAsync([ 'a', 'b' ], (str, index) => ({ index, str }));

🙁 Actual behavior

  • Argument of type '(str: any, index: any) => { index: any; str: any; }' is not assignable to parameter of type '(value: string) => { index: any; str: any; }'.
    Target signature provides too few arguments. Expected 2 or more, but got 1.
  • Parameter 'str' implicitly has an 'any' type.
  • Parameter 'index' implicitly has an 'any' type.

🙂 Expected behavior

index typed as number

Additional information about the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants