Manuel Schiller Manuel Schiller - 1 month ago 9x
TypeScript Question

Interface for dynamic key in typescript

I have an Object like this that is created by underscore's


myObject = {
"key" : [{Object},{Object2},{Object3}],
"key2" : [{Object4},{Object5},{Object6}],

How would I define that as an Interface with TypeScript?
i don't want to simply define it as
myObject:Object = { ...
but rather have an own type for it.


Your object looks like a dictionary of Object arrays

interface Dic {
    [key: string]: Object[]