Typescript support about material.map

Is your feature request related to a problem? Please describe.

Typescript support error’.

Describe the solution you’d like

When I want to destroy a Mesh, VSCode prompts me that the property “map” does not exist on the type “material”.

Describe alternatives you’ve considered

I’ve seen it. There’s no “map” in ‘Material.d.ts’.

Additional context


1 possible answer(s) on “Typescript support about material.map

  1. Material is a base class, and is not intended to list nullable properties for all of its many subclasses. You will need to cast the material to the correct type to get TypeScript to understand the available properties. For example:

    const material = mesh.material as MeshStandardMaterial;
    material.map = texture;