exactOptionalPropertyTypes makes undefined explicit
Without it, { name?: string } accepts { name: undefined }, which is a different thing from "no name" to a spread, to Object.keys, and to JSON. With it on, the property is either there with a string or absent.
{ "compilerOptions": { "exactOptionalPropertyTypes": true } }You will fix a handful of x: cond ? value : undefined spots to use spreads instead, and every one of those was a place where the two meanings were being conflated.
typescript