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

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

Closed
aszczepanek opened this issue May 31, 2019 · 1 comment · Fixed by #31704
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@aszczepanek
Copy link

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'"

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label May 31, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.6.0 milestone May 31, 2019
@ahejlsberg ahejlsberg self-assigned this May 31, 2019
@ahejlsberg
Copy link
Member

Argh, I recently fixed this in #31454, but neglected to update the separate code path we have for property access expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants