Consider this function declaration:
function bar<E extends {}>(baz: Array<{ id: keyof E, data: any, additional: string}>): E[]
Let's also look at this interface:
interface F {
g: boolean
h: number
}
When calling bar with the following values:
bar<F>([{id: 'g', data: false, additional: 'extra'}, {id: 'h', data: 123, additional: 'bonus'}])
The goal is to properly infer the type of the second parameter data
and avoid using any
.
Any suggestions on how to achieve this?
Appreciate your help!