Typescript and Mesh/AbstractMesh Issue

I am using all of the preview packages (4.1.0-rc.5) which are working ok so far. But I have a compile error trying to create an AdvancedDynamicTexture for WebXR UI:

const plane = Mesh.CreatePlane('ui', 1, this.scene);
plane.visibility = 0;
plane.position = new Vector3(0, 1, 0);
const advancedTexture = AdvancedDynamicTexture.CreateForMesh(plane);

This causes this error:

TS2345: Argument of type 'Mesh' is not assignable to parameter of type 'AbstractMesh'.
  Type 'Mesh' is missing the following properties from type 'AbstractMesh': _resyncLighSource, addToSceneRootNodes, removeFromSceneRootNodes

Well this is really weird as Mesh inherits from AbstracMesh

Do you have special linting tools or something?

I am using tslint and tslint-loader via webpack. Trying to explicitly cast gives an error that looks like there’s a conflict with the gui package vs core. So this could DEFINITELY be a configuration issue :sweat:. Especially given this. (<deleted> is just extra long path):

Argument of type 'import("<deleted>/node_modules/@babylonjs/core/Meshes/abstractMesh").AbstractMesh' is not assignable to parameter of type 'import("<deleted>/node_modules/@babylonjs/gui/node_modules/@babylonjs/core/Meshes/abstractMesh").AbstractMesh'.
  Type 'AbstractMesh' is missing the following properties from type 'AbstractMesh': _resyncLighSource, addToSceneRootNodes, removeFromSceneRootNodes

make sure you are getting all the packages from the same version (including GUI of course)

1 Like

AHA! It looks like RC 9 snuck up on me. Indeed GUI was newer than the other packages. I am back in business. Thank you @Deltakosh

1 Like