1.) I upgraded my application’s package.json to the Babylon ‘4.10.0’ version using the TypeScript 3.4.5 compiler and did not encounter any TypeScript compile errors, and my app functioned nominally.
2.) I pulled the Babylon source, checked out 4.10.0 as a local branch, and checked what version of TypeScript compiler was used: "typescript": "~3.7.5"
3.) I changed my application’s package.json to match the above “~3.7.5” version and I get the TypeScript compile error shown below when trying pass a BABYLON.Mesh object to the API function: Ray.intersectsMesh(mesh: DeepImmutable<AbstractMesh>, fastCheck?: boolean): PickingInfo
4.) I experimented until I found what version of TypeScript caused it to generate compile errors:
Using TypeScript 3.4.5, 3.5.2, and 3.5.3 I could pass the BABYLON.Mesh object without compile errors.
Using ‘3.6.1-rc’ <= Typescript version <= ‘3.9.3’ caused the compile error below.
Typescript Compile Error:
Error:(113, 65) TS2345: Argument of type 'Mesh' is not assignable to parameter of type 'DeepImmutableObject<AbstractMesh>'.
Types of property '_internalAbstractMeshDataInfo' are incompatible.
Type '_InternalAbstractMeshDataInfo' is not assignable to type 'DeepImmutableObject<_InternalAbstractMeshDataInfo>'.
Types of property '_skeleton' are incompatible.
Type 'Skeleton' is not assignable to type 'DeepImmutableObject<Skeleton>'.
Types of property 'bones' are incompatible.
Type 'Bone[]' is not assignable to type 'DeepImmutableArray<Bone>'.
Types of property 'concat' are incompatible.
Type '{ (...items: ConcatArray<Bone>[]): Bone[]; (...items: (Bone | ConcatArray<Bone>)[]): Bone[]; }' is not assignable to type '{ (...items: ConcatArray<DeepImmutableObject<Bone>>[]): DeepImmutableObject<Bone>[]; (...items: (DeepImmutableObject<Bone> | ConcatArray<DeepImmutableObject<Bone>>)[]): DeepImmutableObject<Bone>[]; }'.
Types of parameters 'items' and 'items' are incompatible.
Type 'ConcatArray<DeepImmutableObject<Bone>>' is not assignable to type 'ConcatArray<Bone>'.
Type 'DeepImmutableObject<Bone>' is missing the following properties from type 'Bone': _skeleton, _localMatrix, _restPose, _baseMatrix, and 28 more.
@sebavan this still appears to be an issue. I am seeing it using tsc 3.9.7 and 4.1.2 - is anyone looking into fixing this?
The types of '_internalAbstractMeshDataInfo._skeleton' are incompatible between these types.
Type 'Nullable<Skeleton>' is not assignable to type 'DeepImmutableObject<Skeleton> | null'.
Type 'Skeleton' is not assignable to type 'DeepImmutableObject<Skeleton>'.
The types of 'bones.concat' are incompatible between these types.
Type '{ (...items: ConcatArray<Bone>[]): Bone[]; (...items: (Bone | ConcatArray<Bone>)[]): Bone[]; }' is not assignable to type '{ (...items: ConcatArray<DeepImmutableObject<Bone>>[]): DeepImmutableObject<Bone>[]; (...items: (DeepImmutableObject<Bone> | ConcatArray<...>)[]): DeepImmutableObject<...>[]; }'.
Types of parameters 'items' and 'items' are incompatible.
Type 'ConcatArray<DeepImmutableObject<Bone>>' is not assignable to type 'ConcatArray<Bone>'.
Type 'DeepImmutableObject<Bone>' is missing the following properties from type 'Bone': _skeleton, _localMatrix, _restPose, _bindPose, and 29 more.
214 tl.intersectsMesh(canvas/* as DeepImmutableObject<AbstractMesh>*/);```
@sebavan I can’t repro it with a simple project! I guess we are in the clear on this one. For the time being I will use the workaround cast until I can figure out why this large rush project is exhibiting this issue. Thanks for the quick replies!