import type { AnyEntity , Dictionary , IWrappedEntity , IWrappedEntityInternal , PrimaryProperty } from '../typings' ; /**
 * returns WrappedEntity instance associated with this entity. This includes all the internal properties like `__meta` or `__em`.
 */ export function wrap < T , PK extends keyof T | unknown = PrimaryProperty < T > > ( entity , preferHelper ) ; /**
 * wraps entity type with WrappedEntity internal properties and helpers like init/isInitialized/populated/toJSON
 */ export function wrap < T , PK extends keyof T | unknown = PrimaryProperty < T > > ( entity , preferHelper ? ) ; /**
 * wraps entity type with WrappedEntity internal properties and helpers like init/isInitialized/populated/toJSON
 * use `preferHelper = true` to have access to the internal `__` properties like `__meta` or `__em`
 */ export function wrap < T extends AnyEntity < T > , PK extends keyof T | unknown = PrimaryProperty < T > > ( entity , preferHelper = false ) { if ( entity ?. __baseEntity && ! preferHelper ) { return entity as unknown as IWrappedEntity < T , PK > ; } if ( entity ) { return entity . __helper ! ; } return entity as unknown as IWrappedEntity < T , PK > ; }