Skip to content

Commit

Permalink
Refactor ProjectionMethod type
Browse files Browse the repository at this point in the history
  • Loading branch information
Castro, Mario committed Sep 4, 2024
1 parent fbc2067 commit 51dfedc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/framework-core/src/decorators/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type PropertyType<TObj, TProp extends keyof TObj> = TObj[TProp]
type JoinKeyType<TEntity extends EntityInterface, TReadModel extends ReadModelInterface> =
| keyof TEntity
| ReadModelJoinKeyFunction<TEntity, TReadModel>
type UUIDLike = string | UUID

/**
* Decorator to register a read model method as a projection
Expand Down Expand Up @@ -105,7 +106,7 @@ type ProjectionMethod<
> = TJoinKeyType extends ReadModelJoinKeyFunction<TEntity, TReadModel>
? ProjectionMethodWithEntityConditionalReadModelIdAndReadModel<TEntity, TReadModel>
: TJoinKeyType extends keyof TEntity
? NonNullable<PropertyType<TEntity, TJoinKeyType>> extends Array<any>
? NonNullable<PropertyType<TEntity, TJoinKeyType>> extends Array<UUIDLike>
? ProjectionMethodWithEntityReadModelIdAndReadModel<TEntity, TReadModel>
: ProjectionMethodWithEntityAndReadModel<TEntity, TReadModel>
: never
Expand Down

0 comments on commit 51dfedc

Please sign in to comment.