# Typescript Errors with babylonJS:

**URL:** https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899
**Category:** Bugs
**Created:** [December 27, 2022, 5:38am UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899 "2022-12-27T05:38:23Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_Scherotter1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/michael_scherotter1/32/16678_2.png) [@Michael\_Scherotter1](https://forum.babylonjs.com/u/Michael_Scherotter1)
#### Post date: [December 27, 2022, 5:38am UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/1 "2022-12-27T05:38:23Z")

</div>

With Typescript 4.9.4 target ES2020 and BJS 5.39.0, I am getting TypeScript Compile errors:  
Any suggestions?

```auto
../../web/node_modules/babylonjs/babylon.module.d.ts:185616:9 - error TS2416: Property 'executeStep' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(delta: number, impostors: PhysicsImpostor[]) => void' is not assignable to type '{ (delta: number, impostors: PhysicsImpostor[]): void; (delta: number): void; }'.

185616 executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
               ~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:185639:9 - error TS2416: Property 'applyImpulse' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void; (body: PhysicsBody, location: Vector3, impulse: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is missing the following properties from type 'PhysicsImpostor': object, type, _options, _physicsEngine, and 66 more.

185639 applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
               ~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:185719:9 - error TS2416: Property 'setLinearVelocity' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, velocity: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, linVel: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

185719 setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
               ~~~~~~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:185725:9 - error TS2416: Property 'setAngularVelocity' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, velocity: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, angVel: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

185725 setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
               ~~~~~~~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:185928:9 - error TS2416: Property 'executeStep' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(delta: number, impostors: PhysicsImpostor[]) => void' is not assignable to type '{ (delta: number, impostors: PhysicsImpostor[]): void; (delta: number): void; }'.

185928 executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
               ~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:185930:9 - error TS2416: Property 'applyImpulse' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void; (body: PhysicsBody, location: Vector3, impulse: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

185930 applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
               ~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:185950:9 - error TS2416: Property 'setLinearVelocity' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, velocity: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, linVel: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

185950 setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
               ~~~~~~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:185951:9 - error TS2416: Property 'setAngularVelocity' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, velocity: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, angVel: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

185951 setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
               ~~~~~~~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:186007:9 - error TS2416: Property 'executeStep' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(delta: number, impostors: PhysicsImpostor[]) => void' is not assignable to type '{ (delta: number, impostors: PhysicsImpostor[]): void; (delta: number): void; }'.

186007 executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
               ~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:186008:9 - error TS2416: Property 'applyImpulse' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void; (body: PhysicsBody, location: Vector3, impulse: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

186008 applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
               ~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:186018:9 - error TS2416: Property 'setLinearVelocity' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, velocity: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, linVel: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

186018 setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
               ~~~~~~~~~~~~~~~~~

../../web/node_modules/babylonjs/babylon.module.d.ts:186019:9 - error TS2416: Property 'setAngularVelocity' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
  Type '(impostor: PhysicsImpostor, velocity: Vector3) => void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, angVel: Vector3): void; }'.
    Types of parameters 'impostor' and 'body' are incompatible.
      Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.

186019 setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
               ~~~~~~~~~~~~~~~~~~

Found 12 errors in the same file, starting at: ../../web/node_modules/babylonjs/babylon.module.d.ts:185616

```

---

<div class="post-metadata">

### Author: ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)
#### Post date: [December 27, 2022, 11:49am UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/2 "2022-12-27T11:49:00Z")

</div>

Hello! Can you share more about your project configuration? How’s the package.json and the typescript configs? @Cedric is out at this moment 🎄 but he’ll see this as soon as he’s available 🙂

---

<div class="post-metadata">

### Author: ![Michael\_Scherotter1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/michael_scherotter1/32/16678_2.png) [@Michael\_Scherotter1](https://forum.babylonjs.com/u/Michael_Scherotter1)
#### Post date: [December 27, 2022, 6:28pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/3 "2022-12-27T18:28:04Z")

</div>

setting the tsconfig option to skipLibCheck=true fixes this.

---

<div class="post-metadata">

### Author: ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)
#### Post date: [December 27, 2022, 8:39pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/4 "2022-12-27T20:39:29Z")

</div>

I also got this problem with 5.39.0

I posted an issues here as well

> <https://github.com/BabylonJS/Babylon.js/issues/13378>
>
> The 5.39.0 Release introduces new bugs in the Babylon.d.ts
> 
> When type to build… my lib against the new declaration file using TSC 4.6.2. It gets plenty errors now. It did not get those error before.
> 
> \`\`\`
> \[17:25:24\] Using gulpfile ~/Documents/Babylon/BabylonToolkit-Share/Manager/gulpfile.js
> \[17:25:24\] Starting 'default'...
> \[17:25:24\] Starting 'compile'...
> types/babylon.d.ts(80474,9): error TS2416: Property 'executeStep' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(delta: number, impostors: PhysicsImpostor\[\]) =\> void' is not assignable to type '{ (delta: number, impostors: PhysicsImpostor\[\]): void; (delta: number): void; }'.
> types/babylon.d.ts(80497,9): error TS2416: Property 'applyImpulse' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void; (body: PhysicsBody, location: Vector3, impulse: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is missing the following properties from type 'PhysicsImpostor': object, type, \_options, \_physicsEngine, and 66 more.
> types/babylon.d.ts(80577,9): error TS2416: Property 'setLinearVelocity' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, velocity: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, linVel: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> types/babylon.d.ts(80583,9): error TS2416: Property 'setAngularVelocity' in type 'AmmoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, velocity: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, angVel: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> types/babylon.d.ts(80786,9): error TS2416: Property 'executeStep' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(delta: number, impostors: PhysicsImpostor\[\]) =\> void' is not assignable to type '{ (delta: number, impostors: PhysicsImpostor\[\]): void; (delta: number): void; }'.
> types/babylon.d.ts(80788,9): error TS2416: Property 'applyImpulse' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void; (body: PhysicsBody, location: Vector3, impulse: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> types/babylon.d.ts(80808,9): error TS2416: Property 'setLinearVelocity' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, velocity: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, linVel: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> types/babylon.d.ts(80809,9): error TS2416: Property 'setAngularVelocity' in type 'CannonJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, velocity: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, angVel: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> types/babylon.d.ts(80865,9): error TS2416: Property 'executeStep' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(delta: number, impostors: PhysicsImpostor\[\]) =\> void' is not assignable to type '{ (delta: number, impostors: PhysicsImpostor\[\]): void; (delta: number): void; }'.
> types/babylon.d.ts(80866,9): error TS2416: Property 'applyImpulse' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void; (body: PhysicsBody, location: Vector3, impulse: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> types/babylon.d.ts(80876,9): error TS2416: Property 'setLinearVelocity' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, velocity: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, linVel: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> types/babylon.d.ts(80877,9): error TS2416: Property 'setAngularVelocity' in type 'OimoJSPlugin' is not assignable to the same property in base type 'IPhysicsEnginePlugin'.
> Type '(impostor: PhysicsImpostor, velocity: Vector3) =\> void' is not assignable to type '{ (impostor: PhysicsImpostor, velocity: Vector3): void; (body: PhysicsBody, angVel: Vector3): void; }'.
> Types of parameters 'impostor' and 'body' are incompatible.
> Type 'PhysicsBody' is not assignable to type 'PhysicsImpostor'.
> TypeScript: 12 semantic errors
> TypeScript: emit succeeded (with errors)
> \[17:25:38\] Finished 'compile' after 14 s
> \[17:25:38\] Starting '\<anonymous\>'...
> \[17:25:41\] Finished '\<anonymous\>' after 2.77 s
> \[17:25:41\] Finished 'default' after 17 s
> \`\`\`

---

<div class="post-metadata">

### Author: ![WodenWang820118](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wodenwang820118/32/29038_2.png) [@WodenWang820118](https://forum.babylonjs.com/u/WodenWang820118)
#### Post date: [December 30, 2022, 6:37am UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/5 "2022-12-30T06:37:38Z")

</div>

I also found this issue after I install the package. The setup uses Angular 15. Here is the package.json setting.

```auto
"dependencies": {
    "@angular/animations": "^15.0.0",
    "@angular/common": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@types/offscreencanvas": "^2019.7.0",
    "babylonjs": "^5.40.0",
    "normalize.css": "^8.0.1",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.3",
    "@angular/cli": "~15.0.3",
    "@angular/compiler-cli": "^15.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "prettier": "2.8.1",
    "typescript": "~4.8.2"
  }

```

---

<div class="post-metadata">

### Author: ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)
#### Post date: [December 30, 2022, 10:29am UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/6 "2022-12-30T10:29:41Z")

</div>

Once Cedric and Raanan are back they’ll look into it 😃

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [January 2, 2023, 2:10pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/7 "2023-01-02T14:10:55Z")

</div>

@RaananW will have a look soon. I think we might need to update our TS version 🙂

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [January 3, 2023, 12:09pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/8 "2023-01-03T12:09:33Z")

</div>

i’m on it! it’s a UMD issue only. moving to @babylonjs/core instead will prevent this issue, BUT of course we support UMD as well 🙂

---

<div class="post-metadata">

### Author: ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)
#### Post date: [February 1, 2023, 1:20pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/9 "2023-02-01T13:20:36Z")

</div>

Hi @RaananW is this one fixed yet?

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [February 1, 2023, 1:57pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/10 "2023-02-01T13:57:35Z")

</div>

This should have been resolve by now. If it wasn’t please let me know.

---

<div class="post-metadata">

### Author: ![Yurri99](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yurri99/32/29797_2.png) [@Yurri99](https://forum.babylonjs.com/u/Yurri99)
#### Post date: [February 8, 2023, 3:28pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/11 "2023-02-08T15:28:24Z")

</div>

TS2345: Argument of type ‘AbstractMesh’ is not assignable to parameter of type ‘Mesh | AbstractMesh’.  
Type ‘AbstractMesh’ is missing the following properties from type ‘AbstractMesh’: \_physicsBody, physicsBody, getPhysicsBody

So how can I solve this problem

---

<div class="post-metadata">

### Author: ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)
#### Post date: [February 8, 2023, 3:36pm UTC](https://forum.babylonjs.com/t/typescript-errors-with-babylonjs/36899/12 "2023-02-08T15:36:52Z")

</div>

Hello and welcome!

`(m as Mesh)`  
or better

```auto
if (m instanceof Mesh) {
// do something
}

```
