Skip to content

Commit

Permalink
fix(types): allow belongs to and has one to be null (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz authored Sep 23, 2023
1 parent 8769fee commit a014c21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types/relations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export type ThroughRelationOptions<
export type HasOneDecorator = <RelatedModel extends LucidModel>(
model: () => RelatedModel,
options?: RelationOptions<RelatedModel, LucidModel, HasOne<RelatedModel, LucidModel>>
) => TypedDecorator<HasOne<RelatedModel>>
) => TypedDecorator<HasOne<RelatedModel> | null>

/**
* Decorator signature to define has many relationship
Expand All @@ -130,7 +130,7 @@ export type HasManyDecorator = <RelatedModel extends LucidModel>(
export type BelongsToDecorator = <RelatedModel extends LucidModel>(
model: () => RelatedModel,
options?: RelationOptions<RelatedModel, LucidModel, HasOne<RelatedModel, LucidModel>>
) => TypedDecorator<BelongsTo<RelatedModel>>
) => TypedDecorator<BelongsTo<RelatedModel> | null>

/**
* Decorator signature to define many to many relationship
Expand Down

0 comments on commit a014c21

Please sign in to comment.