# It is currently impossible to check if an object is a certain type/weird iface error

**URL:** https://forum.makecode.com/t/it-is-currently-impossible-to-check-if-an-object-is-a-certain-type-weird-iface-error/18108
**Category:** Help
**Created:** [February 21, 2023, 10:54pm UTC](https://forum.makecode.com/t/it-is-currently-impossible-to-check-if-an-object-is-a-certain-type-weird-iface-error/18108 "2023-02-21T22:54:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hasanchik](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hasanchik/32/5885_2.png) [@hasanchik](https://forum.makecode.com/u/hasanchik)
#### Post date: [February 21, 2023, 10:54pm UTC](https://forum.makecode.com/t/it-is-currently-impossible-to-check-if-an-object-is-a-certain-type-weird-iface-error/18108/1 "2023-02-21T22:54:11Z")

</div>

Hi there. I have a weird problem going on when trying to make my platformer game. In my game I need to check if an object is my custom animation class or the default image class. Makecode Arcade really does not want me to do this though for some reason. I’ve tried every trick in the book. I will be listing each method under here with their corresponding errors. Could anyone please help me with this?

Method 1:

```auto
function IsObjectAnimation(object: any): object is Animation {
  return 'delayPerFrame' in object && 'animationState' in object
}

```

Error: (roughly) “In” is an unsupported operator

Method 2:

```auto
function IsObjectAnimation(object: any): boolean {
  if (object.hasOwnProperty("delayPerFrame") && object.hasOwnProperty("animationState")) {
    return true
  }
  return false
}

```

“Error”: The simulator does not want to start, it just crashes and halts without spitting any errors

Method 3:

```auto
function IsObjectAnimation(object: any): object is Animation {
  return typeof object.isAnimation === 'boolean'
}

```

Error: ‘Cannot read properties of undefined (reading ‘iface’)  
at (line 2)’  
(Test code i was using:

````auto
let image: Image = image.create(8, 8)
console.log(renderer.IsObjectAnimation(image))
```)

These issues could all be fixed by updating to a newer version of typescript, although that can cause some problems. I don't know if that is feasible but if it is you should upgrade the language to a newer version to avoid causing headaches like this lol
````

---

<div class="post-metadata">

### Author: ![SOCKMONSTER12](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sockmonster12/32/7584_2.png) [@SOCKMONSTER12](https://forum.makecode.com/u/SOCKMONSTER12)
#### Post date: [February 22, 2023, 5:58pm UTC](https://forum.makecode.com/t/it-is-currently-impossible-to-check-if-an-object-is-a-certain-type-weird-iface-error/18108/2 "2023-02-22T17:58:47Z")

</div>

you could try downloading an animation extension

---

<div class="post-metadata">

### Author: ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)
#### Post date: [February 24, 2023, 6:01pm UTC](https://forum.makecode.com/t/it-is-currently-impossible-to-check-if-an-object-is-a-certain-type-weird-iface-error/18108/3 "2023-02-24T18:01:44Z")

</div>

I’ve dealt with this issue before. i think you’re looking for

```auto
object isinstance <your custom class here>

```

It’s a method that works for me and it should correctly check if some object is of that type. It’s also way more practical than checking for properties
