0

I want to use Indexers in typescript like C# Indexers. For example,

class example {
  public this[row: number, column: number];
}

Is this possible in Typescript?

Indexers: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/indexers/using-indexers

kalpa
  • 657
  • 2
  • 11
  • 22
  • It would require a decent amount of code generation from typescript so it is not possible since TS is trying to be as close as possible to plain JS. – Jake Nov 01 '17 at 13:39
  • @JakeWeary Can you suggest a close alternative that I can opt for? – kalpa Nov 01 '17 at 13:44
  • Possible duplicate of [Implementing an indexer in a class in TypeScript](https://stackoverflow.com/questions/14841598/implementing-an-indexer-in-a-class-in-typescript) – Legends Nov 01 '17 at 13:46
  • 1
    Just define regular `get()` `set()` methods on your class? – Jake Nov 01 '17 at 13:47

0 Answers0