title: Threejs Geometry and TypeScript
body: <p>I would like to write correct types for the Mesh Vertices and Faces.</p>
  
  <p>In the first example, I create a new Mesh, and when I want to access Vertices and Faces from geometry, I get a few errors:</p>
  
  <pre><code>const material = new THREE.MeshLambertMaterial({color: 0x00ff00});
  const geometry = new THREE.Geometry();
  const newMesh = new THREE.Mesh(geometry, material);
  scene.add(newMesh);
  
  const { vertices, faces } = newMesh.geometry;
  // Error: Property 'vertices' does not exist on type 'BufferGeometry | Geometry'
  // Error: Property 'faces' does not exist on type 'Geometry | BufferGeometry'.
  
  newMesh.geometry.colorsNeedUpdate = true;
  // Error: Property 'colorsNeedUpdate' does not exist on type 'Geometry | BufferGeometry'.
  </code></pre>
  
  <p>In the second example, I get Mesh from the Scene, and then I get the following error:</p>
  
  <pre><code>const mesh = scene.getObjectByName('boxMesh');
  const geometry = mesh.geometry; 
  // Property 'geometry' does not exist on type 'Object3D'.
  </code></pre>