I can hypothesize that the problem could be related to some kind of TS type or some strict runtime check. In other words it could be something like the following:
interface B {
t?: string;
l?: string;
p?: string;
}
is different from
interface B {
t?: string | undefined;
l?: string | undefined;
p?: string | undefined;
}
Or, related to runtime check, t in a
gives different results than a.t !== undefined
for those cases.
Yes, because if null
is a one million dollar mistake, JS had the nice idea to have 3 different ways of expressing a slightly different variant of a null value (
undefined
, null
and the absence of the field).
I would like to get an answer from the OP as well, but at the same time I am curious about possible approaches in Rescript (other than going %raw
). Said that, there are a lot of JS projects out there that don’t even distinguish a null
from a 0
or an empty string, so…
EDIT: just to throw ideas, this should work, but obviously it requires a bit of boilerplate.