import { IDomainEvent } from './IDomainEvent' ; export abstract class BaseEntity { private domainEvents : IDomainEvent [ ] = [ ] ; public addDomainEvent ( domainEvent ) { this . domainEvents . push ( domainEvent ) ; } public releaseDomainEvents ( ) { const events = this . domainEvents ; this . domainEvents = [ ] ; return events ; } }