Why doesn’t type inference work in this scenario?
module M = {
type t = {foo: string}
}
let a = []
let b: array<M.t> = a->Array.map(x => {foo: x})
It says the record field foo can’t be found. But I just gave it the context of M.t. This works:
let b = a->Array.map((x): M.t => {foo: x})
I understand why that works but it is way less intuitive to look at.