For example, I want an object to have an unlimited number of fields, but all of them to be strings.
1 answer
It seems to be done very simply:
interface Foo { [key:string]: string // all key must be string }
Here you can read more: https://basarat.gitbooks.io/typescript/content/docs/types/index-signatures.html
|