From 295058d123490ea19b10dbe030fbc6f1193ac835 Mon Sep 17 00:00:00 2001 From: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:11:43 +0200 Subject: [PATCH] fix: use Object.prototype.hasOwnProperty.call for safe property checks (#27661) The error 'TypeError: value.hasOwnProperty is not a function' can occur when objects are created without the standard Object prototype (e.g., via Object.create(null) or certain parsing methods). Using Object.prototype.hasOwnProperty.call() is the safe way to check for property existence on any object. Fixed in: - GetSlotsInputPipe (isById, isByUsernameAndEventTypeSlug, isByTeamSlugAndEventTypeSlug) - CancelBookingInputPipe (isCancelSeatedBookingInput) - CreateBookingInputPipe (isRecurringBookingInput, isInstantBookingInput) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../2024-08-13/inputs/cancel-booking-input.pipe.ts | 2 +- .../2024-08-13/inputs/create-booking-input.pipe.ts | 6 ++++-- .../slots-2024-09-04/inputs/get-slots-input.pipe.ts | 12 +++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/platform/types/bookings/2024-08-13/inputs/cancel-booking-input.pipe.ts b/packages/platform/types/bookings/2024-08-13/inputs/cancel-booking-input.pipe.ts index baad69ed01..444d32d6b0 100644 --- a/packages/platform/types/bookings/2024-08-13/inputs/cancel-booking-input.pipe.ts +++ b/packages/platform/types/bookings/2024-08-13/inputs/cancel-booking-input.pipe.ts @@ -77,6 +77,6 @@ export class CancelBookingInputPipe implements PipeTransform { private isCancelSeatedBookingInput( value: CancelBookingInput ): value is CancelSeatedBookingInput_2024_08_13 { - return value.hasOwnProperty("seatUid"); + return Object.prototype.hasOwnProperty.call(value, "seatUid"); } } diff --git a/packages/platform/types/bookings/2024-08-13/inputs/create-booking-input.pipe.ts b/packages/platform/types/bookings/2024-08-13/inputs/create-booking-input.pipe.ts index ad9665b46d..66a55b395e 100644 --- a/packages/platform/types/bookings/2024-08-13/inputs/create-booking-input.pipe.ts +++ b/packages/platform/types/bookings/2024-08-13/inputs/create-booking-input.pipe.ts @@ -102,10 +102,12 @@ export class CreateBookingInputPipe implements PipeTransform { private isRecurringBookingInput( value: CreateBookingInput ): value is CreateRecurringBookingInput_2024_08_13 { - return value.hasOwnProperty("recurrenceCount"); + return Object.prototype.hasOwnProperty.call(value, "recurrenceCount"); } private isInstantBookingInput(value: CreateBookingInput): value is CreateInstantBookingInput_2024_08_13 { - return value.hasOwnProperty("instant") && "instant" in value && value.instant === true; + return ( + Object.prototype.hasOwnProperty.call(value, "instant") && "instant" in value && value.instant === true + ); } } diff --git a/packages/platform/types/slots/slots-2024-09-04/inputs/get-slots-input.pipe.ts b/packages/platform/types/slots/slots-2024-09-04/inputs/get-slots-input.pipe.ts index 080f08724d..105a49dbb8 100644 --- a/packages/platform/types/slots/slots-2024-09-04/inputs/get-slots-input.pipe.ts +++ b/packages/platform/types/slots/slots-2024-09-04/inputs/get-slots-input.pipe.ts @@ -131,18 +131,24 @@ export class GetSlotsInputPipe implements PipeTransform { } private isById(value: GetSlotsInput_2024_09_04): value is ById_2024_09_04 { - return value.hasOwnProperty("eventTypeId"); + return Object.prototype.hasOwnProperty.call(value, "eventTypeId"); } private isByUsernameAndEventTypeSlug( value: GetSlotsInput_2024_09_04 ): value is ByUsernameAndEventTypeSlug_2024_09_04 { - return value.hasOwnProperty("username") && value.hasOwnProperty("eventTypeSlug"); + return ( + Object.prototype.hasOwnProperty.call(value, "username") && + Object.prototype.hasOwnProperty.call(value, "eventTypeSlug") + ); } private isByTeamSlugAndEventTypeSlug( value: GetSlotsInput_2024_09_04 ): value is ByTeamSlugAndEventTypeSlug_2024_09_04 { - return value.hasOwnProperty("teamSlug") && value.hasOwnProperty("eventTypeSlug"); + return ( + Object.prototype.hasOwnProperty.call(value, "teamSlug") && + Object.prototype.hasOwnProperty.call(value, "eventTypeSlug") + ); } }