Skip to content

Type false is not assignable to type this[keyof this] (in 2.1.4) #12878

Closed
@newapx

Description

@newapx

TypeScript Version: 2.1.4

Code

// A *self-contained* demonstration of the problem follows...
export class ClassA {
  public clean() {
    for (let prop in this) {
      if (typeof this[prop] === "boolean")  this[prop] = false;
    }
  }
}

Expected behavior:
Compiled without error

Actual behavior:
Error Type false is not assignable to type this[keyof this]

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions