Typescript doesn't recognize "attributes" in BufferGeometry

I’m using typescript in one project and i noticed that one property is not being recognized by typescript.
Is this an intentional error or I made a typo in something?

I wrote this to make sure that the property exists:

console.log(…, line.geometry.attributes, …)

There are two types of geometry in three.js: BufferGeometry and Geometry. The TS compiler does not know which your model will contain at compile time. If you know it is BufferGeometry (this is the only one supported in the most recent version of three.js) then you can cast it and the TS compiler will figure out the rest:

const geometry = mesh.geometry as BufferGeometry;
console.log(geometry.attributes);
1 Like