Skip to content

[3.5.1] Class index signature stopped working - property does not exist on type #31691

Closed
@aszczepanek

Description

@aszczepanek

TypeScript Version: 3.5.1

Search Terms:
index signature, property does not exist

Code

export class Test {
  [k: string]: any;

  someMethod() {
    this.age = 3;
  }
}

Expected behavior:
There should be no error, age assignment is correct according to index signature.
It used to work in typescript 3.4.5

Actual behavior:
Error "Property 'age' does not exist on type 'Test'"

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions