Skip to content

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

Description

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

Activity

  1. ahejlsberg commented on May 31, 2019

    @ahejlsberg
    Member

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

  2. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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