I'm trying to type the value parameter of the setObject function :
type setValueType<T> = (newValue: T) => void
const useObject = () => {
const setObject = <T>(property: string, value: any, object: T, setValue: setValueType<T>) => {
setValue({
...object,
[property]: value
})
}
return {
setObject
}
}
export default useObject
But I don't know what to put for the value type.
I want that value to be type of T[property] but I don't know how to make this...