Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Matrix toArray typings #1132

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading