Skip to content

Commit

Permalink
fix(⏺️): fix bug in isRRect (#2822)
Browse files Browse the repository at this point in the history
The implementation was using the `in` operation which doesn't work on host objects.
  • Loading branch information
wcandillon authored Dec 18, 2024
1 parent cca99c4 commit b7a55c5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/skia/src/skia/types/RRect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
};

0 comments on commit b7a55c5

Please sign in to comment.