const myObj = { a: 1, b: 'some_string' } as const; type values = typeof myObj[keyof typeof myObj];type Dictionary = { [key: string]: any }let indexedArray: {[key: string]: number} let indexedArray: {[key: string]: number} = { foo: 123, bar: 456 } indexedArray['foo'] = 12; indexedArray.foo= 45;Typescript interfaces aren''t being compiled into the js output, and you can not use them at runtimeconst satisfies = <T,>() => <U extends T>(u: U) => u; const mapper1 = satisfies<Record<string, Type1>>()({ foo1: bar1, foo2: bar2 }); const mapper2 = satisfies<Record<string, Type2>>()({ foo3: bar3, foo4: bar4 }); export type MapperKeys = keyof typeof mapper1 | keyof typeof mapper2; // type MapperKeys = "foo1" | "foo2" | "foo3" | "foo4"