in typescript-generator/src/index.ts [361:374]
function lookupBehavior (type: M.Interface, name: string): M.Inherits | null {
if (!type.attachedBehaviors?.includes(name)) return null // eslint-disable-line
if (Array.isArray(type.behaviors)) {
const behavior = type.behaviors.find(i => i.type.name === name)
if (behavior != null) return behavior
}
if (type.inherits == null) return null
const parentType = model.types.find(t => t.name.name === type.inherits?.type.name)
if (parentType == null) return null
if (parentType.kind === 'interface') {
return lookupBehavior(parentType, name)
}
throw new Error('Should inherit from an interface')
}