R128 migration issues

Hey, im working on a Angular Typescript project and am currently updating THREEjs from r124 to the latest version r128 and have some migration issues. I looked inside the changelog and migration guide, but nothing is stating anything for typescript users and the newly outsourced types. I installed the three typings as stated here, but still have a few functions/properties that are missing. I dont know if the typings are missing or whether they got replaced/removed. I still find them in the docs. Found nothing about it in the changelogs Here’s a list of errors I get:

onBeforeCompile on MeshDepthMaterial

new THREE.MeshDepthMaterial().onBeforeCompile = (shader) => { } 

Property ‘onBeforeCompile’ does not exist on type ‘MeshDepthMaterial’.

renderer.render(…) render mesh instead of scene

this.renderer.render( mesh, camera )

Argument of type ‘Mesh’ is not assignable to parameter of type ‘Scene’.

Renderer outputencoding

renderer.outputEncoding = THREE.sRGBEncoding

Property ‘outputEncoding’ does not exist on type ‘WebGLRenderer’.


new THREE.WebGLMultisampleRenderTarget()

Property ‘WebGLMultisampleRenderTarget’ does not exist on type ‘typeof import("…/node_modules/@types/three/index")’.

mesh.material = [mat1, mat2, mat3, mat4, mat5, mat6]

Type ‘Material[]’ is not assignable to type ‘MeshBasicMaterial | MeshDepthMaterial | MeshLambertMaterial | MeshStandardMaterial | … 5 more … | MeshMaterialType[]’.

Do I have to make every Material type MeshMaterialType now?

Any help appreaciated

It’s probably best if you report your findings to this repository:

In this way, the devs how maintain the TS type declaration files will easier notice the issues and hopefully fix them.

1 Like