Skip to content

v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:447

Interface representing its WGSL vector type counterpart: vec2f or vec2. A vector with 2 elements of type f32

  • Tuple2<number>.Swizzle2<v2f, v3f, v4f>.vecInfixNotation<v2f>

[n: number]: number

readonly [$internal]: true

Defined in: packages/typegpu/src/data/wgslTypes.ts:449


readonly [unscopables]: object

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:97

Is an object whose properties have the value ‘true’ when they will be absent when used in a ‘with’ statement.

[key: number]: undefined | boolean

optional [iterator]: boolean

readonly optional [unscopables]: boolean

Is an object whose properties have the value ‘true’ when they will be absent when used in a ‘with’ statement.

optional at: boolean

optional concat: boolean

optional copyWithin: boolean

optional entries: boolean

optional every: boolean

optional fill: boolean

optional filter: boolean

optional find: boolean

optional findIndex: boolean

optional findLast: boolean

optional findLastIndex: boolean

optional flat: boolean

optional flatMap: boolean

optional forEach: boolean

optional includes: boolean

optional indexOf: boolean

optional join: boolean

optional keys: boolean

optional lastIndexOf: boolean

optional length: boolean

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

optional map: boolean

optional pop: boolean

optional push: boolean

optional reduce: boolean

optional reduceRight: boolean

optional reverse: boolean

optional shift: boolean

optional slice: boolean

optional some: boolean

optional sort: boolean

optional splice: boolean

optional toLocaleString: boolean

optional toReversed: boolean

optional toSorted: boolean

optional toSpliced: boolean

optional toString: boolean

optional unshift: boolean

optional values: boolean

optional with: boolean

Tuple2.[unscopables]


0: number

Tuple2.0


1: number

Tuple2.1


readonly kind: "vec2f"

Defined in: packages/typegpu/src/data/wgslTypes.ts:451

use to distinguish between vectors of the same size on the type level


length: 2

Tuple2.length


x: number

Defined in: packages/typegpu/src/data/wgslTypes.ts:452


readonly xx: v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:126

Swizzle2.xx


readonly xxx: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:131

Swizzle2.xxx


readonly xxxx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:140

Swizzle2.xxxx


readonly xxxy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:141

Swizzle2.xxxy


readonly xxy: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:132

Swizzle2.xxy


readonly xxyx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:142

Swizzle2.xxyx


readonly xxyy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:143

Swizzle2.xxyy


readonly xy: v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:127

Swizzle2.xy


readonly xyx: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:133

Swizzle2.xyx


readonly xyxx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:144

Swizzle2.xyxx


readonly xyxy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:145

Swizzle2.xyxy


readonly xyy: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:134

Swizzle2.xyy


readonly xyyx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:146

Swizzle2.xyyx


readonly xyyy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:147

Swizzle2.xyyy


y: number

Defined in: packages/typegpu/src/data/wgslTypes.ts:453


readonly yx: v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:128

Swizzle2.yx


readonly yxx: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:135

Swizzle2.yxx


readonly yxxx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:148

Swizzle2.yxxx


readonly yxxy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:149

Swizzle2.yxxy


readonly yxy: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:136

Swizzle2.yxy


readonly yxyx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:150

Swizzle2.yxyx


readonly yxyy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:151

Swizzle2.yxyy


readonly yy: v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:129

Swizzle2.yy


readonly yyx: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:137

Swizzle2.yyx


readonly yyxx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:152

Swizzle2.yyxx


readonly yyxy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:153

Swizzle2.yyxy


readonly yyy: v3f

Defined in: packages/typegpu/src/data/wgslTypes.ts:138

Swizzle2.yyy


readonly yyyx: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:154

Swizzle2.yyyx


readonly yyyy: v4f

Defined in: packages/typegpu/src/data/wgslTypes.ts:155

Swizzle2.yyyy

[iterator](): ArrayIterator<number>

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:78

Iterator

ArrayIterator<number>

Tuple2.[iterator]


add(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:51

number

v2f

vecInfixNotation.add

add(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:52

v2f

v2f

vecInfixNotation.add


at(index): undefined | number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2022.array.d.ts:24

Returns the item located at the specified index.

number

The zero-based index of the desired code unit. A negative index will count back from the last item.

undefined | number

Tuple2.at


concat(…items): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1350

Combines two or more arrays. This method returns a new array without modifying any existing arrays.

ConcatArray<number>[]

Additional arrays and/or items to add to the end of the array.

number[]

Tuple2.concat

concat(…items): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1356

Combines two or more arrays. This method returns a new array without modifying any existing arrays.

…(number | ConcatArray<number>)[]

Additional arrays and/or items to add to the end of the array.

number[]

Tuple2.concat


copyWithin(target, start, end?): this

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.core.d.ts:62

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

number

If target is negative, it is treated as length+target where length is the length of the array.

number

If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

number

If not specified, length of the this object is used as its default value.

this

Tuple2.copyWithin


div(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:61

number

v2f

vecInfixNotation.div

div(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:62

v2f

v2f

vecInfixNotation.div


entries(): ArrayIterator<[number, number]>

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:83

Returns an iterable of key, value pairs for every entry in the array

ArrayIterator<[number, number]>

Tuple2.entries


every<S>(predicate, thisArg?): this is S[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1433

Determines whether all the members of an array satisfy the specified test.

S extends number

(value, index, array) => value is S

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

this is S[]

Tuple2.every

every(predicate, thisArg?): boolean

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1442

Determines whether all the members of an array satisfy the specified test.

(value, index, array) => unknown

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

boolean

Tuple2.every


fill(value, start?, end?): this

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.core.d.ts:51

Changes all array elements from start to end index to a static value and returns the modified array

number

value to fill array section with

number

index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

number

index to stop filling the array at. If end is negative, it is treated as length+end.

this

Tuple2.fill


filter<S>(predicate, thisArg?): S[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1469

Returns the elements of an array that meet the condition specified in a callback function.

S extends number

(value, index, array) => value is S

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

S[]

Tuple2.filter

filter(predicate, thisArg?): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1475

Returns the elements of an array that meet the condition specified in a callback function.

(value, index, array) => unknown

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

number[]

Tuple2.filter


find<S>(predicate, thisArg?): undefined | S

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.core.d.ts:29

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

S extends number

(value, index, obj) => value is S

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

undefined | S

Tuple2.find

find(predicate, thisArg?): undefined | number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.core.d.ts:30

(value, index, obj) => unknown

any

undefined | number

Tuple2.find


findIndex(predicate, thisArg?): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.core.d.ts:41

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

(value, index, obj) => unknown

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

number

Tuple2.findIndex


findLast<S>(predicate, thisArg?): undefined | S

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:29

Returns the value of the last element in the array where predicate is true, and undefined otherwise.

S extends number

(value, index, array) => value is S

findLast calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLast immediately returns that element value. Otherwise, findLast returns undefined.

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

undefined | S

Tuple2.findLast

findLast(predicate, thisArg?): undefined | number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:30

(value, index, array) => unknown

any

undefined | number

Tuple2.findLast


findLastIndex(predicate, thisArg?): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:41

Returns the index of the last element in the array where predicate is true, and -1 otherwise.

(value, index, array) => unknown

findLastIndex calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

number

Tuple2.findLastIndex


flat<A, D>(this, depth?): FlatArray<A, D>[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2019.array.d.ts:75

Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

A

D extends number = 1

A

D

The maximum recursion depth

FlatArray<A, D>[]

Tuple2.flat


flatMap<U, This>(callback, thisArg?): U[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2019.array.d.ts:64

Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

U

This = undefined

(this, value, index, array) => U | readonly U[]

A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

This

An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

U[]

Tuple2.flatMap


forEach(callbackfn, thisArg?): void

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1457

Performs the specified action for each element in an array.

(value, index, array) => void

A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

void

Tuple2.forEach


includes(searchElement, fromIndex?): boolean

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2016.array.include.d.ts:25

Determines whether an array includes a certain element, returning true or false as appropriate.

number

The element to search for.

number

The position in this array at which to begin searching for searchElement.

boolean

Tuple2.includes


indexOf(searchElement, fromIndex?): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1418

Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

number

The value to locate in the array.

number

The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

number

Tuple2.indexOf


join(separator?): string

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1361

Adds all the elements of an array into a string, separated by the specified separator string.

string

A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

string

Tuple2.join


keys(): ArrayIterator<number>

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:88

Returns an iterable of keys in the array

ArrayIterator<number>

Tuple2.keys


lastIndexOf(searchElement, fromIndex?): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1424

Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

number

The value to locate in the array.

number

The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

number

Tuple2.lastIndexOf


map<U>(callbackfn, thisArg?): U[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1463

Calls a defined callback function on each element of an array, and returns an array that contains the results.

U

(value, index, array) => U

A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

U[]

Tuple2.map


mul(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:57

number

v2f

vecInfixNotation.mul

mul(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:58

v2f

v2f

vecInfixNotation.mul

mul(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:59

m2x2f

v2f

vecInfixNotation.mul


pop(): undefined | number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1339

Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

undefined | number

Tuple2.pop


push(…items): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1344

Appends new elements to the end of an array, and returns the new length of the array.

number[]

New elements to add to the array.

number

Tuple2.push


reduce(callbackfn): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1481

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

(previousValue, currentValue, currentIndex, array) => number

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

number

Tuple2.reduce

reduce(callbackfn, initialValue): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1482

(previousValue, currentValue, currentIndex, array) => number

number

number

Tuple2.reduce

reduce<U>(callbackfn, initialValue): U

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1488

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

U

(previousValue, currentValue, currentIndex, array) => U

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

U

Tuple2.reduce


reduceRight(callbackfn): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1494

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

(previousValue, currentValue, currentIndex, array) => number

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

number

Tuple2.reduceRight

reduceRight(callbackfn, initialValue): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1495

(previousValue, currentValue, currentIndex, array) => number

number

number

Tuple2.reduceRight

reduceRight<U>(callbackfn, initialValue): U

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1501

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

U

(previousValue, currentValue, currentIndex, array) => U

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

U

Tuple2.reduceRight


reverse(): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1366

Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.

number[]

Tuple2.reverse


shift(): undefined | number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1371

Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

undefined | number

Tuple2.shift


slice(start?, end?): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1381

Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

number

The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

number

The end index of the specified portion of the array. This is exclusive of the element at the index ‘end’. If end is undefined, then the slice extends to the end of the array.

number[]

Tuple2.slice


some(predicate, thisArg?): boolean

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1451

Determines whether the specified callback function returns true for any element of an array.

(value, index, array) => unknown

A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

boolean

Tuple2.some


sort(compareFn?): this

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1392

Sorts an array in place. This method mutates the array and returns a reference to the same array.

(a, b) => number

Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they’re equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.

[11,2,22,1].sort((a, b) => a - b)

this

Tuple2.sort


splice(start, deleteCount?): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1399

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

number

The zero-based location in the array from which to start removing elements.

number

The number of elements to remove.

number[]

An array containing the elements that were deleted.

Tuple2.splice

splice(start, deleteCount, …items): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1407

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

number

The zero-based location in the array from which to start removing elements.

number

The number of elements to remove.

number[]

Elements to insert into the array in place of the deleted elements.

number[]

An array containing the elements that were deleted.

Tuple2.splice


sub(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:54

number

v2f

vecInfixNotation.sub

sub(other): v2f

Defined in: packages/typegpu/src/data/wgslTypes.ts:55

v2f

v2f

vecInfixNotation.sub


toLocaleString(): string

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1334

Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

string

Tuple2.toLocaleString

toLocaleString(locales, options?): string

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.core.d.ts:64

string | string[]

NumberFormatOptions & DateTimeFormatOptions

string

Tuple2.toLocaleString


toReversed(): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:46

Returns a copy of an array with its elements reversed.

number[]

Tuple2.toReversed


toSorted(compareFn?): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:57

Returns a copy of an array with its elements sorted.

(a, b) => number

Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they’re equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.

[11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]

number[]

Tuple2.toSorted


toSpliced(start, deleteCount, …items): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:66

Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.

number

The zero-based location in the array from which to start removing elements.

number

The number of elements to remove.

number[]

Elements to insert into the copied array in place of the deleted elements.

number[]

The copied array.

Tuple2.toSpliced

toSpliced(start, deleteCount?): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:74

Copies an array and removes elements while returning the remaining elements.

number

The zero-based location in the array from which to start removing elements.

number

The number of elements to remove.

number[]

A copy of the original array with the remaining elements.

Tuple2.toSpliced


toString(): string

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1330

Returns a string representation of an array.

string

Tuple2.toString


unshift(…items): number

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1412

Inserts new elements at the start of an array, and returns the new length of the array.

number[]

Elements to insert at the start of the array.

number

Tuple2.unshift


values(): ArrayIterator<number>

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:93

Returns an iterable of values in the array

ArrayIterator<number>

Tuple2.values


with(index, value): number[]

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2023.array.d.ts:85

Copies an array, then overwrites the value at the provided index with the given value. If the index is negative, then it replaces from the end of the array.

number

The index of the value to overwrite. If the index is negative, then it replaces from the end of the array.

number

The value to write into the copied array.

number[]

The copied array with the updated value.

Tuple2.with