镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Update declaration of ts.Iterator to be compatible with ES2015 IteratorResult type #31214

Description

TypeScript Version: 3.5.0-dev.20190502

Search Terms:

Code

I'm trying to use the API changes of #31101, but I run into assignability issues.

import * as ts from 'typescript';
return ts.getParsedCommandLineOfConfigFile('foo', {}, undefined!, new Map<string, ts.ExtendedConfigCacheEntry>());

Expected behavior:

No type error.

Actual behavior:

Argument of type 'Map<string, ExtendedConfigCacheEntry>' is not assignable to parameter of type 'Map<ExtendedConfigCacheEntry>'.
  Types of property 'keys' are incompatible.
    Type '() => IterableIterator<string>' is not assignable to type '() => Iterator<string>'.
      Type 'IterableIterator<string>' is not assignable to type 'Iterator<string>'.
        Types of property 'next' are incompatible.
          Type '(value?: any) => IteratorResult<string>' is not assignable to type '() => { value: never; done: true; } | { value: string; done: false; }'.
            Type 'IteratorResult<string>' is not assignable to type '{ value: never; done: true; } | { value: string; done: false; }'.
              Type 'IteratorResult<string>' is not assignable to type '{ value: string; done: false; }'.
                Types of property 'done' are incompatible.
                  Type 'boolean' is not assignable to type 'false'.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions