If there is a way to convert immutable record types to mutable ones, then should be straightforward to correctly type immer’s produce function
type person = {
name: string,
age: int
}
// converts to
type person = {
mutable name: string,
mutable age: int
}