Let say i have a structure like this:
type Dict<T = any> = {[key: string]: T}
type AsObject<T extends Dict> = {
[K in keyof T]: (x: any) => T[K]
}
What i do need is the same structure as an array, but how to capture the type for that specific key in the function?
type AsArray<T extends Dict> = {
key: keyof T
fn: (x: any) => T[??] // how to get typeof key from here ?
}[]
Record<T>is an existing type that covers what your Dict type does