a type utility to apply tuple feature to TypedArray such as Float32Array in TypeScript context
const vector3 = new Float32Array(3).fill(0);
vector3[0] // 0
vector3[1] // 0
vector3[2] // 0
vector3[3] // undefined
let vector2: Float32Tuple<2>;
vector2 = new Float32Array(1); // Error
vector2 = new Float32Array(2); // OK
vector2 = new Float32Array(3); // OKnpm i -D typed-tuple-typeTo load typed-tuple-type, add "node_modules/typed-tuple-type" to typeRoots in your tsconfig.json
{
  "compilerOptions": {
    "typeRoots": [
      "node_modules/@types",
      "node_modules/typed-tuple-type"
    ]
  },
}