Skip to content

Commit

Permalink
Improve Matrix toArray typings (#1132)
Browse files Browse the repository at this point in the history
* Improve Matrix toArray typings

* Update
  • Loading branch information
Methuselah96 committed Jul 25, 2024
1 parent 19da889 commit 8b549ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions types/three/src/math/Matrix3.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,15 @@ export class Matrix3 {
/**
* Writes the elements of this matrix to an array in
* {@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major} format.
* @param array (optional) array to store the resulting vector in. If not given a new array will be created.
*/
toArray(): Matrix3Tuple;
/**
* Writes the elements of this matrix to an array in
* {@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major} format.
* @param array array to store the resulting vector in. If not given a new array will be created.
* @param offset (optional) offset in the array at which to put the result.
*/
toArray<TArray extends ArrayLike<number> = number[]>(array?: TArray, offset?: number): TArray;
toArray<TArray extends ArrayLike<number>>(array: TArray, offset?: number): TArray;

clone(): this;
}
9 changes: 7 additions & 2 deletions types/three/src/math/Matrix4.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,13 @@ export class Matrix4 {
/**
* Writes the elements of this matrix to an array in
* {@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major} format.
* @param array (optional) array to store the resulting vector in.
*/
toArray(): Matrix4Tuple;
/**
* Writes the elements of this matrix to an array in
* {@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major} format.
* @param array array to store the resulting vector in.
* @param offset (optional) offset in the array at which to put the result.
*/
toArray<TArray extends ArrayLike<number> = number[]>(array?: TArray, offset?: number): TArray;
toArray<TArray extends ArrayLike<number>>(array: TArray, offset?: number): TArray;
}

0 comments on commit 8b549ac

Please sign in to comment.