import { Component, Vue } from 'vue-property-decorator'; import { ValidatorGroup } from '../../types/validators'; @Component({}) export class ValidatorMixin extends Vue { get validatorEventBus() { let target: ValidatorGroup = this; while (target && !target.eventBus && target.$parent) { target = target.$parent; } if (!target) { console.warn('Should have eventBus on an ancestor, make sure your / is inside a validator-group-base'); return null; } return target.eventBus; } }