Skip to content

Commit 4873bfb

Browse files
committed
Use instanceof for type guards
1 parent a09707a commit 4873bfb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/modules-lib/src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export abstract class glAnimation {
1919

2020
public abstract getFrame(timestamp: number): AnimFrame;
2121

22-
public static isAnimation = (obj: any): obj is glAnimation => obj.fps !== undefined;
22+
public static isAnimation = (obj: any): obj is glAnimation => obj instanceof glAnimation;
2323
}
2424
export interface AnimFrame {
2525
draw: (canvas: HTMLCanvasElement) => void;

src/bundles/rune/src/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ export class HollusionRune extends DrawnRune {
650650
}
651651

652652
/** @hidden */
653-
export const isHollusionRune = (rune: DrawnRune): rune is HollusionRune => rune.isHollusion;
653+
export const isHollusionRune = (rune: DrawnRune): rune is HollusionRune => rune instanceof HollusionRune;
654654

655655
/**
656656
* Makes a new Rune from two given Runes by

0 commit comments

Comments
 (0)