Record fields are found based on being scope in the current module. If the field is defined in a nested module, then it is not in scope in the current module. You can follow the instructions in the error message to fix the error:
let b = a->Array.map(x => {M.foo: x})
Type annotations are not required.