This is a TypeScript only related problem.
mesh will be never
null, it can be a
Mesh instance or
undefined as seen on the second screenshot.
Obviously, you can’t call the constructor with a
Getting the scene should be also changed to:
scene = scene ?? camera.getScene()
camera can not be
undefined according to d.ts. If one provides the
scene parameter, it should take precedence.