The first parameter isn't correct. It should be the `Number of vertices that the indices will reference.` For example, if you have a position attribute with the array flattened to contain the components, you would create the indices like this:
```javascript
var numberOfVertices = geometry.attributes.position.values.length / 3;
var indices = IndexDatatype.createTypedArray(numberOfVertices, length);
```
It doesn't matter which attribute you use. The number of vertices will be `flattened attribute array length / number of attribute components`.