Problem
Home emits false TS2698 for a nullable generic object spread:
function spread<Meta extends object | undefined>(value: Meta | undefined) {
return { ...value };
}TypeScript 6.0.3 and the TypeScript 7 native preview accept the same strict, no-emit source.
This surfaced while giving WeakMap#get its correct V | undefined result in #662; the pinned Zod graph then exposed the same defect in registries.ts.
Root cause
objectSpreadSourceIsValid recognizes type parameters constrained to nullish-only types inside unions, but reads the constraint's aggregated flags without first excluding union/intersection constraints. object | undefined therefore carries is_undefined and is incorrectly skipped as if the entire constraint were undefined, leaving no spreadable branch.
Fair oracle
Positive:
T extends object | undefined- operand
T | undefined - object spread of that operand
- TypeScript 6.0.3 and TypeScript 7: 0 diagnostics
- Home parent: false
TS2698
Negative control:
- A hard
T & undefinedintersection remainsTS2698, matching both reference compilers and the existing permanent regression.
Acceptance criteria
- Recurse through union/intersection constraints instead of treating their aggregated nullish flags as nullish-only.
- Preserve the hard-nullish intersection rejection.
- Add permanent regression coverage.
- Verify no new diagnostic identities on the pinned Zod graph.
Blocks the zero-addition admission gate for #662; tracks #416 and #548.