From b7a55c5213d3a6bd31c196d26bbd0a8c57060047 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 18 Dec 2024 16:21:10 +0100 Subject: [PATCH] =?UTF-8?q?fix(=E2=8F=BA=EF=B8=8F):=20fix=20bug=20in=20isR?= =?UTF-8?q?Rect=20(#2822)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The implementation was using the `in` operation which doesn't work on host objects. --- packages/skia/src/skia/types/RRect.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/skia/src/skia/types/RRect.ts b/packages/skia/src/skia/types/RRect.ts index 16f7ba7d20..486e173306 100644 --- a/packages/skia/src/skia/types/RRect.ts +++ b/packages/skia/src/skia/types/RRect.ts @@ -18,6 +18,12 @@ export interface NonUniformRRect { export type InputRRect = SkRRect | NonUniformRRect; // We have an issue to check property existence on JSI backed instances -export const isRRect = (def: SkRect | SkRRect): def is SkRRect => - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (def as any).rect !== undefined; +export const isRRect = (def: unknown): def is SkRRect => { + "worklet"; + return ( + typeof def === "object" && + def !== null && + // eslint-disable-next-line @typescript-eslint/no-explicit-any + typeof (def as any).rect === "object" + ); +};