# Error TS2420: Class 'XRWebGLLayer' incorrectly implements interface 'XRLayer'

**URL:** <https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713>\
**Category:** Bugs\
**Created:** [October 12, 2022, 12:40am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713 "2022-10-12T00:40:55Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![elalish](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/elalish/32/27414_2.png) [@elalish](https://forum.babylonjs.com/u/elalish)\
**Post date:** [October 12, 2022, 12:40am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/1 "2022-10-12T00:40:55Z")

</div>

I’m trying to update TS from 4.3.5 to 4.8.4 in this repo, which uses babylon: [model-viewer/packages/render-fidelity-tools at master · google/model-viewer · GitHub](https://github.com/google/model-viewer/tree/master/packages/render-fidelity-tools)

I’m getting a bunch of errors along the lines of:  
**@google/model-viewer-render-fidelity-tools** : node\_modules/@babylonjs/core/Engines/engine.d.ts(2421,7): error TS2420: Class ‘XRWebGLLayer’ incorrectly implements interface ‘XRLayer’.

**@google/model-viewer-render-fidelity-tools** : Property ‘prototype’ is missing in type ‘XRWebGLLayer’ but required in type ‘EventTarget’.

**@google/model-viewer-render-fidelity-tools** : node\_modules/@babylonjs/core/XR/native/nativeXRRenderTarget.d.ts(13,14): error TS2416: Property ‘layer’ in type ‘NativeXRLayerWrapper’ is not assignable to the same property in base type ‘WebXRLayerWrapper’.

**@google/model-viewer-render-fidelity-tools** : Type ‘XRWebGLLayer’ is not assignable to type ‘XRLayer’.

I also tried updating babylon from 5.0 to 5.27, but the errors remain. Is babylon incompatible with the latest TS (at least with strict checks enabled)?

---

<div class="post-metadata">

**Author:** ![brianzinn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brianzinn/32/28013_2.png) [@brianzinn](https://forum.babylonjs.com/u/brianzinn)\
**Post date:** [October 12, 2022, 1:07am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/2 "2022-10-12T01:07:36Z")

</div>

I usually follow package.json - not sure what official word is:

> <https://github.com/BabylonJS/Babylon.js/blob/master/package.json#L46>

---

<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:** [October 12, 2022, 5:02am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/3 "2022-10-12T05:02:09Z")

</div>

This is probably a discrepancy between the WebXR typing we and they are using. I’ll check the WebXR declaration later today.  
Those types are not coming from TS, so it’s not the version of the package. My assumption is that the use is because they are using the @types/webxr, and we use our own custom declaration

---

<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:** [October 12, 2022, 5:02am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/4 "2022-10-12T05:02:14Z")

</div>

Assigned @RaananW on October 12, 2022, 5:02am UTC



---

<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:** [October 12, 2022, 4:23pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/5 "2022-10-12T16:23:52Z")

</div>

[[XR] update the webxr typings to match current state by RaananW · Pull Request #13104 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/13104)

---

<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:** [October 12, 2022, 4:23pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/6 "2022-10-12T16:23:57Z")

</div>

Unassigned @RaananW on October 12, 2022, 4:23pm UTC



---

<div class="post-metadata">

**Author:** ![elalish](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/elalish/32/27414_2.png) [@elalish](https://forum.babylonjs.com/u/elalish)\
**Post date:** [October 12, 2022, 4:56pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/7 "2022-10-12T16:56:41Z")

</div>

Thanks for the quick response! I tried TS v4.6.2, but same problem. v4.3.5 does work, so I’d guess there are just more strict checks that have been added? Does “they” indicate me in this context? I don’t have @types/webxr in this build and I’m not using babylon for anything WebXR related, hence why this feels like more of a core incompatibility. Is there some set of TS checks that need to be disabled to build babylon?

---

<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:** [October 12, 2022, 6:35pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/8 "2022-10-12T18:35:50Z")

</div>

you can see the tsconfig we are using while developing and while building:

[Babylon.js/tsconfig.build.json at master · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/blob/master/tsconfig.build.json)

---

<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:** [October 12, 2022, 6:54pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/9 "2022-10-12T18:54:11Z")

</div>

Oh, and you have not included the types, but other packages might have. check if it is in your node\_modules as a dependency

---

<div class="post-metadata">

**Author:** ![axeljaeger](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/axeljaeger/32/21445_2.png) [@axeljaeger](https://forum.babylonjs.com/u/axeljaeger)\
**Post date:** [October 13, 2022, 8:20pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/10 "2022-10-13T20:20:35Z")

</div>

I am getting the exact same error when using babylon-versions 5.20 - 5.24. Did you find the solution? I tried downgrading babylons and ts to different version but I am unable to go down to TS 4.3 as another dep (angular) requires at least 4.6.2.

When I try to update to the most recent version of babylon, this particular error disappears for me but others appear. This might be related, maybe both have a common reason.

```auto

2684 eyetrackingstart: XREyeTrackingEvent;
                           ~~~~~~~~~~~~~~~~~~

Error: node_modules/@babylonjs/core/Engines/engine.d.ts:2685:21 - error TS2304: Cannot find name 'XREyeTrackingEvent'.

2685 eyetrackingend: XREyeTrackingEvent;
                         ~~~~~~~~~~~~~~~~~~

Error: node_modules/@babylonjs/core/Engines/engine.d.ts:2840:5 - error TS2300: Duplicate identifier 'createAnchor'.

2840 createAnchor?: (pose: XRRigidTransform, space: XRSpace) => Promise<XRAnchor> | undefined;
         ~~~~~~~~~~~~

Error: node_modules/@babylonjs/core/Engines/engine.d.ts:2980:11 - error TS2320: Interface 'XRHand' cannot simultaneously extend types 'Map<any, any>' and 'Map<number, XRJointSpace>'.
  Named property '[Symbol.iterator]' of types 'Map<any, any>' and 'Map<number, XRJointSpace>' are not identical.

2980 interface XRHand extends Map<number, XRJointSpace> {
```

---

<div class="post-metadata">

**Author:** ![elalish](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/elalish/32/27414_2.png) [@elalish](https://forum.babylonjs.com/u/elalish)\
**Post date:** [October 13, 2022, 10:41pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/11 "2022-10-13T22:41:38Z")

</div>

I verified that @types/webxr is _not_ in my node\_modules. However, I did find a solution in your tsconfig: `"skipLibCheck": true`

---

<div class="post-metadata">

**Author:** ![HouLingLXH](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/houlinglxh/32/14545_2.png) [@HouLingLXH](https://forum.babylonjs.com/u/HouLingLXH)\
**Post date:** [October 17, 2022, 7:16am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/12 "2022-10-17T07:16:27Z")

</div>

Not fixed yet in v5.28.0 ?

“skipLibCheck”: true is not a normal way to handle it,right ?

---

<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:** [October 17, 2022, 10:43am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/13 "2022-10-17T10:43:51Z")

</div>

the typing is already there, so there shouldn’t be any conflict with any other typings loaded. I’ll check that later this week, but until then skipLibCheck can be used to ignore the issue, yes.

---

<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:** [October 17, 2022, 10:43am UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/14 "2022-10-17T10:43:55Z")

</div>

Assigned @RaananW on October 17, 2022, 10:43am UTC



---

<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:** [October 26, 2022, 4:56pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/15 "2022-10-26T16:56:12Z")

</div>

This PR will fix this:

> <https://github.com/BabylonJS/Babylon.js/pull/13172>

---

<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:** [October 26, 2022, 4:56pm UTC](https://forum.babylonjs.com/t/error-ts2420-class-xrwebgllayer-incorrectly-implements-interface-xrlayer/34713/16 "2022-10-26T16:56:16Z")

</div>

Unassigned @RaananW on October 26, 2022, 4:56pm UTC


