INNER CODE UNIT · TypeScript
newRequired
runvendo/vendo · packages/vendo/src/actions/sync/index.ts:134
const newRequired = arrayValue(newSchema.required).filter((value): value is string => typeof value === "string");
if (newRequired.some((name) => !oldRequired.has(name))) return true;
const oldProperties = objectValue(oldSchema.properties);
const newProperties = objectValue(newSchema.properties);
for (const [name, oldRawProperty] of Object.entries(oldProperties)) {
if (!Object.prototype.hasOwnProperty.call(newProperties, name)) return true;
const oldProperty = objectValue(oldRawProperty);
const newProperty = objectValue(newProperties[name]);
// Type changes are narrowing only when the new type set drops an old type
// (mirrors the enum logic below: widenings are backward-compatible).
const oldTypes = typeNames(oldProperty.type);
const newTypes = typeNames(newProperty.type);
if (oldTypes.length === 0 && newTypes.length > 0) return true;
if (oldTypes.length > 0 && newTypes.length > 0) {
const newTypeSet = new Set(newTypes);
if (oldTypes.some((name) => !newTypeSet.has(name))) return true;
}