2 Matching Annotations
- Oct 2019
-
-
Index types are really handy when you have an object that could have unknown keys. They're also handy when using an object as a dictionary or associative array. They do have some downsides, though. You can't specify what keys can be used, and the syntax is also a bit verbose, in my opinion. TypeScript provides a solution, however; the Record utility.
-
-
www.typescriptlang.org www.typescriptlang.org
-
With index types, you can get the compiler to check code that uses dynamic property names.
-