typescript interface for object with arbitrary numeric property names 3f

Solutions on MaxInterview for typescript interface for object with arbitrary numeric property names 3f by the best coders in the world

showing results for - "typescript interface for object with arbitrary numeric property names 3f"
Sonny
06 Jan 2019
1interface NumberToString {
2    [n: number]: string;
3}
4
5var x: NumberToString;
6x = { 1: 42 }; // Error
7x[1].charAt(0); // OK
8
9x['foo'] = 'bar'; // Still not an error, though
10
similar questions