Anywhere VectorArgRest is required, you can use either:
a number
an array of numbers
a tuple composed by a single array of numbers
a Vector
Which in practice means:
// ...functionmyFunction(...param:VectorArgRest){// ...};myFunction(1); // a numbermyFunction(1,2,3); // an array of numbers (spread as rest parameters)myFunction([1,2,3]); // a tuple composed by an array of numbersmyFunction(newVector()); // a Vector
You can use the static convertToSameDimVector method to turn VectorArgRest into a Vector of a desired dimension
// Vector.convertToSameDimVector(dim: number, ...args: VectorArgRest);// numberVector.convertToSameDimVector(3,1); // Vector<3> [1,1,1]Vector.convertToSameDimVector(2,1); // Vector<2> [1,1]// rest arrayVector.convertToSameDimVector(3,1,2,3); // Vector<3> [1,2,3]Vector.convertToSameDimVector(2,1,2,3); // Vector<2> [1,2]// tuple of a single arrayVector.convertToSameDimVector(3, [1,2,3]); // Vector<3> [1,2,3]Vector.convertToSameDimVector(2, [1,2,3]); // Vector<2> [1,2]// from another VectorVector.convertToSameDimVector(3,newVector(1,2,3)); // Vector<3> [1,2,3]Vector.convertToSameDimVector(2,newVector(1,2,3)); // Vector<2> [1,2]