Skip to content

Commit

Permalink
added var args to Aggregate
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jonathan committed Jan 1, 2024
1 parent 3da3c88 commit 0a07268
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cosmicmind/domainjs",
"version": "0.0.1-rc-010124-4",
"version": "0.0.1-rc-010124-4-a",
"description": "A domain-driven design framework for scalable systems.",
"keywords": [],
"author": {
Expand Down
2 changes: 1 addition & 1 deletion src/Aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type AggregateTypeFor<A> = A extends Aggregate<infer E> ? E : A

export type AggregateConstructor<A extends Aggregate<Entity>> = new (root: AggregateTypeFor<A>, ...args: unknown[]) => A

export function defineAggregate<A extends Aggregate<Entity>>(_class: AggregateConstructor<A>, handler: EntityLifecycle<AggregateTypeFor<A>> = {}): (root: AggregateTypeFor<A>) => A {
export function defineAggregate<A extends Aggregate<Entity>>(_class: AggregateConstructor<A>, handler: EntityLifecycle<AggregateTypeFor<A>> = {}): (root: AggregateTypeFor<A>, ...args: unknown[]) => A {
const createEntity = defineEntity<AggregateTypeFor<A>>(handler)
return (root: AggregateTypeFor<A>, ...args: unknown[]): A => new _class(createEntity(root), ...args)
}

0 comments on commit 0a07268

Please sign in to comment.