diff --git a/packages/core/src/decorators/OneToOne.ts b/packages/core/src/decorators/OneToOne.ts index 7b1bf1b79bb6..cee0562c2066 100644 --- a/packages/core/src/decorators/OneToOne.ts +++ b/packages/core/src/decorators/OneToOne.ts @@ -5,9 +5,11 @@ import type { AnyString, EntityName } from '../typings'; export function OneToOne( entity?: OneToOneOptions | string | ((e?: any) => EntityName), - mappedBy?: (string & keyof T) | ((e: T) => any), + mappedByOrOptions?: (string & keyof T) | ((e: T) => any) | Partial>, options: Partial> = {}, ) { + const mappedBy = typeof mappedByOrOptions === 'object' ? mappedByOrOptions.mappedBy : mappedByOrOptions; + options = typeof mappedByOrOptions === 'object' ? { ...mappedByOrOptions, ...options } : options; return createOneToDecorator(entity as string, mappedBy, options, ReferenceType.ONE_TO_ONE); }