Alternatively, since there aren’t that many fields here, all of the pattern matching could be done at once.
let mapper: (a) => b = (a) =>
switch a {
| {t, l, p} => {t, l: "int", p: "array"}
| {t, l} => {t, l: "int"}
| {t, p} => {t, p: "array"}
| {l, p} => {l: "int", p: "array"}
| {t} => {t: t}
| {l} => {l: "int"}
| {p} => {p: "array"}
| {} => {}
}
Not that I’d recommend this for larger records.