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

spurious check error on Iterator.toArray() #23523

Open
rjbudzynski opened this issue Apr 24, 2024 · 1 comment
Open

spurious check error on Iterator.toArray() #23523

rjbudzynski opened this issue Apr 24, 2024 · 1 comment
Labels
types Issues related to TypeScript types

Comments

@rjbudzynski
Copy link

rjbudzynski commented Apr 24, 2024

Version: Deno 1.42.4

File test.ts contains:

const a = new Array(10).keys().toArray()
console.log(a)

Running it works as expected:

$ deno run test.ts
[
  0, 1, 2, 3, 4,
  5, 6, 7, 8, 9
]

But:

$ deno check test.ts
Check file:///home/rjb/Work/Deno/misc/test.ts
error: TS2339 [ERROR]: Property 'toArray' does not exist on type 'IterableIterator<number>'.
const a = new Array(10).keys().toArray()
                               ~~~~~~~
    at file:///home/rjb/Work/Deno/misc/test.ts:1:32

Yes, .toArray() on general Iterables is marked as experimental (as per MDN), however since it's implemented in Deno, the check error is spurious.

@marvinhagemeister marvinhagemeister added the types Issues related to TypeScript types label Apr 24, 2024
@Delapouite
Copy link

Probably another manifestation of this issue #23357

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

No branches or pull requests

3 participants