in src/validator.ts [270:304]
function _validatePropertyImplementation(
property: spec.Property,
type: spec.ClassType | spec.InterfaceType,
): boolean {
if (!type.interfaces) {
// Abstract classes may not directly implement all members, need to check their supertypes...
if (spec.isClassType(type) && type.base && type.abstract) {
return _validatePropertyImplementation(
property,
_dereference(type.base, assembly, validator) as spec.ClassType,
);
}
return false;
}
for (const iface of type.interfaces) {
const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;
const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);
if (implemented) {
_assertPropertiesMatch(
implemented,
property,
`${type.fqn}#${property.name}`,
`implementing ${ifaceType.fqn}`,
);
// We won't replace a previous overrides declaration from a property override, as those
// have higher precedence than an initial implementation.
property.overrides = property.overrides ?? ifaceType.fqn;
return true;
}
if (_validatePropertyImplementation(property, ifaceType)) {
return true;
}
}
return false;
}