I have function with generic type.
But it return an error Type 'boolean' is not assignable to type 'string'.
function testing<K, V>(array: Array<{ key: K, value: V }>): Array<V> {
return array.map(data => data.value)
}
testing([{ key: 1, value: "one" }, { key: 2, value: true }])
How can I fix this generic type issue with keeping the type generic. Because the array is unknown and the value may have different custom type.
any, no?anytype should be avoidedanyisunknown, it forces the caller to type check it.anyorunknown.