Skip to content

Type Declarations for Iterator.from #26783

Description

@chances

The TypeScript team have resecently made some changes to the Iterator group of interfaces, protocols, and their related type definitions. For context, the TypeScript team is in the middle of making changes to the type declarations regarding iterators after TC39 recently landed changes for iterator helpers.

Either I'm confused and am using the types incorrectly, or the version of TypeScript being used by Deno is outdated.

My apologies if this is the incorrect repository.

Reproduction

index.ts:

return Iterator.from([1, 2, 3]).map(x => x * 2);

deno.json:

{
  "$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
  "exports": "./index.ts",
  "compilerOptions": {
    "lib": ["ESNext", "DOM.Iterable", "deno.window"]
  }
}

Error reported by the Deno language server

ts: 'Iterator' only refers to a type, but is being used as a value here.

Deno Runtime Versions

Deno 2.0.5 (stable, release, x86_64-pc-windows-msvc)
V8 12.9.202.13-rusty
TypeScript 5.6.2

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions