<B, A>(b: B, f: (b: B, a: A) => B): (
self: Iterable<A>
) => NonEmptyArray<B>
<A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>Folds right-to-left while keeping every intermediate accumulator value.
When to use
Use to compute a running accumulator from right to left where each intermediate value is needed.
Details
The output length is input.length + 1 because it ends with the initial
value. The result is always a NonEmptyArray.
Example (Scanning running totals in reverse)
import { Array } from "effect"
const result = Array.scanRight([1, 2, 3, 4], 0, (acc, value) => acc + value)
console.log(result) // [10, 9, 7, 4, 0]export const const scanRight: {
<B, A>(b: B, f: (b: B, a: A) => B): (
self: Iterable<A>
) => NonEmptyArray<B>
<A, B>(
self: Iterable<A>,
b: B,
f: (b: B, a: A) => B
): NonEmptyArray<B>
}
Folds right-to-left while keeping every intermediate accumulator value.
When to use
Use to compute a running accumulator from right to left where each intermediate
value is needed.
Details
The output length is input.length + 1 because it ends with the initial
value. The result is always a NonEmptyArray.
Example (Scanning running totals in reverse)
import { Array } from "effect"
const result = Array.scanRight([1, 2, 3, 4], 0, (acc, value) => acc + value)
console.log(result) // [10, 9, 7, 4, 0]
scanRight: {
<function (type parameter) B in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>B, function (type parameter) A in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>A>(b: Bb: function (type parameter) B in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>B, f: (b: B, a: A) => Bf: (b: Bb: function (type parameter) B in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>B, a: Aa: function (type parameter) A in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>A) => function (type parameter) B in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>B): (self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>A>) => type NonEmptyArray<A> = [A, ...A[]]A mutable array guaranteed to have at least one element.
When to use
Use when mutation is acceptable and non-emptiness must be tracked at the type
level.
Details
This is the mutable counterpart of
NonEmptyReadonlyArray
. Most Array
module functions return NonEmptyArray when the result is guaranteed
non-empty.
Example (Typing a mutable non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyArray<number> = [1, 2, 3]
nonEmpty.push(4)
NonEmptyArray<function (type parameter) B in <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>B>
<function (type parameter) A in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>A, function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>A>, b: Bb: function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B, f: (b: B, a: A) => Bf: (b: Bb: function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B, a: Aa: function (type parameter) A in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>A) => function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B): type NonEmptyArray<A> = [A, ...A[]]A mutable array guaranteed to have at least one element.
When to use
Use when mutation is acceptable and non-emptiness must be tracked at the type
level.
Details
This is the mutable counterpart of
NonEmptyReadonlyArray
. Most Array
module functions return NonEmptyArray when the result is guaranteed
non-empty.
Example (Typing a mutable non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyArray<number> = [1, 2, 3]
nonEmpty.push(4)
NonEmptyArray<function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B>
} = dual<(...args: Array<any>) => any, <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B) => NonEmptyArray<B>>(arity: 3, body: <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B) => NonEmptyArray<B>): ((...args: Array<any>) => any) & (<A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B) => NonEmptyArray<B>) (+1 overload)Creates a function that can be called in data-first style or data-last
(pipe-friendly) style.
When to use
Use to expose one implementation through both direct and pipe-friendly
call styles.
Details
Pass either the arity of the uncurried function or a predicate that decides
whether the current call is data-first. Arity is the common case. Use a
predicate when optional arguments make arity ambiguous.
Example (Selecting data-first or data-last style by arity)
import { Function, pipe } from "effect"
const sum = Function.dual<
(that: number) => (self: number) => number,
(self: number, that: number) => number
>(2, (self, that) => self + that)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
Example (Defining overloads with call signatures)
import { Function, pipe } from "effect"
const sum: {
(that: number): (self: number) => number
(self: number, that: number): number
} = Function.dual(2, (self: number, that: number): number => self + that)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
Example (Selecting data-first or data-last style with a predicate)
import { Function, pipe } from "effect"
const sum = Function.dual<
(that: number) => (self: number) => number,
(self: number, that: number) => number
>(
(args) => args.length === 2,
(self, that) => self + that
)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
dual(3, <function (type parameter) A in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>A, function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>A>, b: Bb: function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B, f: (b: B, a: A) => Bf: (b: Bb: function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B, a: Aa: function (type parameter) A in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>A) => function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B): type NonEmptyArray<A> = [A, ...A[]]A mutable array guaranteed to have at least one element.
When to use
Use when mutation is acceptable and non-emptiness must be tracked at the type
level.
Details
This is the mutable counterpart of
NonEmptyReadonlyArray
. Most Array
module functions return NonEmptyArray when the result is guaranteed
non-empty.
Example (Typing a mutable non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyArray<number> = [1, 2, 3]
nonEmpty.push(4)
NonEmptyArray<function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B> => {
const const input: A[]input = const fromIterable: <A>(
collection: Iterable<A>
) => A[]
Converts an Iterable to an Array.
When to use
Use to convert any Iterable (Set, Generator, etc.) into an array.
Details
If the input is already an array, this returns it by reference without
copying. Otherwise, it creates a new array from the iterable. Use copy if
you need a fresh array even when the input is already an array.
Example (Converting a Set to an array)
import { Array } from "effect"
const result = Array.fromIterable(new Set([1, 2, 3]))
console.log(result) // [1, 2, 3]
fromIterable(self: Iterable<A>self)
const const out: NonEmptyArray<B>const out: {
0: B;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => B | undefined;
push: (...items: Array<B>) => number;
concat: { (...items: Array<ConcatArray<B>>): Array<B>; (...items: Array<B | ConcatArray<B>>): Array<B> };
join: (separator?: string) => string;
reverse: () => Array<B>;
shift: () => B | undefined;
slice: (start?: number, end?: number) => Array<B>;
sort: (compareFn?: ((a: B, b: B) => number) | undefined) => [B, ...B[]];
splice: { (start: number, deleteCount?: number): Array<B>; (start: number, deleteCount: number, ...items: Array<B>): Array<B> };
unshift: (...items: Array<B>) => number;
indexOf: (searchElement: B, fromIndex?: number) => number;
lastIndexOf: (searchElement: B, fromIndex?: number) => number;
every: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): this is S[]; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: B, index: number, array: Array<B>) => void, thisArg?: any) => void;
map: (callbackfn: (value: B, index: number, array: Array<B>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): Array<S>; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): Array<B> };
reduce: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
reduceRight: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
find: { (predicate: (value: B, index: number, obj: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any): B | undefined };
findIndex: (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any) => number;
fill: (value: B, start?: number, end?: number) => [B, ...B[]];
copyWithin: (target: number, start: number, end?: number) => [B, ...B[]];
entries: () => ArrayIterator<[number, B]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<B>;
includes: (searchElement: B, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: B, index: number, array: Array<B>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => B | undefined;
findLast: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): B | undefined };
findLastIndex: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => number;
toReversed: () => Array<B>;
toSorted: (compareFn?: ((a: B, b: B) => number) | undefined) => Array<B>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<B>): Array<B>; (start: number, deleteCount?: number): Array<B> };
with: (index: number, value: B) => Array<B>;
}
out: type NonEmptyArray<A> = [A, ...A[]]A mutable array guaranteed to have at least one element.
When to use
Use when mutation is acceptable and non-emptiness must be tracked at the type
level.
Details
This is the mutable counterpart of
NonEmptyReadonlyArray
. Most Array
module functions return NonEmptyArray when the result is guaranteed
non-empty.
Example (Typing a mutable non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyArray<number> = [1, 2, 3]
nonEmpty.push(4)
NonEmptyArray<function (type parameter) B in <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>B> = new const Array: ArrayConstructor
new (arrayLength?: number) => any[] (+2 overloads)
Array(const input: A[]input.Array<T>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length + 1) as any
const out: NonEmptyArray<B>const out: {
0: B;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => B | undefined;
push: (...items: Array<B>) => number;
concat: { (...items: Array<ConcatArray<B>>): Array<B>; (...items: Array<B | ConcatArray<B>>): Array<B> };
join: (separator?: string) => string;
reverse: () => Array<B>;
shift: () => B | undefined;
slice: (start?: number, end?: number) => Array<B>;
sort: (compareFn?: ((a: B, b: B) => number) | undefined) => [B, ...B[]];
splice: { (start: number, deleteCount?: number): Array<B>; (start: number, deleteCount: number, ...items: Array<B>): Array<B> };
unshift: (...items: Array<B>) => number;
indexOf: (searchElement: B, fromIndex?: number) => number;
lastIndexOf: (searchElement: B, fromIndex?: number) => number;
every: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): this is S[]; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: B, index: number, array: Array<B>) => void, thisArg?: any) => void;
map: (callbackfn: (value: B, index: number, array: Array<B>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): Array<S>; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): Array<B> };
reduce: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
reduceRight: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
find: { (predicate: (value: B, index: number, obj: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any): B | undefined };
findIndex: (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any) => number;
fill: (value: B, start?: number, end?: number) => [B, ...B[]];
copyWithin: (target: number, start: number, end?: number) => [B, ...B[]];
entries: () => ArrayIterator<[number, B]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<B>;
includes: (searchElement: B, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: B, index: number, array: Array<B>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => B | undefined;
findLast: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): B | undefined };
findLastIndex: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => number;
toReversed: () => Array<B>;
toSorted: (compareFn?: ((a: B, b: B) => number) | undefined) => Array<B>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<B>): Array<B>; (start: number, deleteCount?: number): Array<B> };
with: (index: number, value: B) => Array<B>;
}
out[const input: A[]input.Array<T>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length] = b: Bb
for (let let i: numberi = const input: A[]input.Array<T>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length - 1; let i: numberi >= 0; let i: numberi--) {
const out: NonEmptyArray<B>const out: {
0: B;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => B | undefined;
push: (...items: Array<B>) => number;
concat: { (...items: Array<ConcatArray<B>>): Array<B>; (...items: Array<B | ConcatArray<B>>): Array<B> };
join: (separator?: string) => string;
reverse: () => Array<B>;
shift: () => B | undefined;
slice: (start?: number, end?: number) => Array<B>;
sort: (compareFn?: ((a: B, b: B) => number) | undefined) => [B, ...B[]];
splice: { (start: number, deleteCount?: number): Array<B>; (start: number, deleteCount: number, ...items: Array<B>): Array<B> };
unshift: (...items: Array<B>) => number;
indexOf: (searchElement: B, fromIndex?: number) => number;
lastIndexOf: (searchElement: B, fromIndex?: number) => number;
every: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): this is S[]; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: B, index: number, array: Array<B>) => void, thisArg?: any) => void;
map: (callbackfn: (value: B, index: number, array: Array<B>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): Array<S>; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): Array<B> };
reduce: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
reduceRight: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
find: { (predicate: (value: B, index: number, obj: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any): B | undefined };
findIndex: (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any) => number;
fill: (value: B, start?: number, end?: number) => [B, ...B[]];
copyWithin: (target: number, start: number, end?: number) => [B, ...B[]];
entries: () => ArrayIterator<[number, B]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<B>;
includes: (searchElement: B, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: B, index: number, array: Array<B>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => B | undefined;
findLast: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): B | undefined };
findLastIndex: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => number;
toReversed: () => Array<B>;
toSorted: (compareFn?: ((a: B, b: B) => number) | undefined) => Array<B>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<B>): Array<B>; (start: number, deleteCount?: number): Array<B> };
with: (index: number, value: B) => Array<B>;
}
out[let i: numberi] = f: (b: B, a: A) => Bf(const out: NonEmptyArray<B>const out: {
0: B;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => B | undefined;
push: (...items: Array<B>) => number;
concat: { (...items: Array<ConcatArray<B>>): Array<B>; (...items: Array<B | ConcatArray<B>>): Array<B> };
join: (separator?: string) => string;
reverse: () => Array<B>;
shift: () => B | undefined;
slice: (start?: number, end?: number) => Array<B>;
sort: (compareFn?: ((a: B, b: B) => number) | undefined) => [B, ...B[]];
splice: { (start: number, deleteCount?: number): Array<B>; (start: number, deleteCount: number, ...items: Array<B>): Array<B> };
unshift: (...items: Array<B>) => number;
indexOf: (searchElement: B, fromIndex?: number) => number;
lastIndexOf: (searchElement: B, fromIndex?: number) => number;
every: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): this is S[]; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: B, index: number, array: Array<B>) => void, thisArg?: any) => void;
map: (callbackfn: (value: B, index: number, array: Array<B>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): Array<S>; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): Array<B> };
reduce: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
reduceRight: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
find: { (predicate: (value: B, index: number, obj: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any): B | undefined };
findIndex: (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any) => number;
fill: (value: B, start?: number, end?: number) => [B, ...B[]];
copyWithin: (target: number, start: number, end?: number) => [B, ...B[]];
entries: () => ArrayIterator<[number, B]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<B>;
includes: (searchElement: B, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: B, index: number, array: Array<B>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => B | undefined;
findLast: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): B | undefined };
findLastIndex: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => number;
toReversed: () => Array<B>;
toSorted: (compareFn?: ((a: B, b: B) => number) | undefined) => Array<B>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<B>): Array<B>; (start: number, deleteCount?: number): Array<B> };
with: (index: number, value: B) => Array<B>;
}
out[let i: numberi + 1], const input: A[]input[let i: numberi])
}
return const out: NonEmptyArray<B>const out: {
0: B;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => B | undefined;
push: (...items: Array<B>) => number;
concat: { (...items: Array<ConcatArray<B>>): Array<B>; (...items: Array<B | ConcatArray<B>>): Array<B> };
join: (separator?: string) => string;
reverse: () => Array<B>;
shift: () => B | undefined;
slice: (start?: number, end?: number) => Array<B>;
sort: (compareFn?: ((a: B, b: B) => number) | undefined) => [B, ...B[]];
splice: { (start: number, deleteCount?: number): Array<B>; (start: number, deleteCount: number, ...items: Array<B>): Array<B> };
unshift: (...items: Array<B>) => number;
indexOf: (searchElement: B, fromIndex?: number) => number;
lastIndexOf: (searchElement: B, fromIndex?: number) => number;
every: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): this is S[]; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: B, index: number, array: Array<B>) => void, thisArg?: any) => void;
map: (callbackfn: (value: B, index: number, array: Array<B>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): Array<S>; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): Array<B> };
reduce: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
reduceRight: { (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B): B; (callbackfn: (previousValue: B, currentValue: B, currentIndex: number, array: Array<B>) => B, initialValue: B): B; (callbackfn: (previousVa…;
find: { (predicate: (value: B, index: number, obj: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any): B | undefined };
findIndex: (predicate: (value: B, index: number, obj: Array<B>) => unknown, thisArg?: any) => number;
fill: (value: B, start?: number, end?: number) => [B, ...B[]];
copyWithin: (target: number, start: number, end?: number) => [B, ...B[]];
entries: () => ArrayIterator<[number, B]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<B>;
includes: (searchElement: B, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: B, index: number, array: Array<B>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => B | undefined;
findLast: { (predicate: (value: B, index: number, array: Array<B>) => value is S, thisArg?: any): S | undefined; (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any): B | undefined };
findLastIndex: (predicate: (value: B, index: number, array: Array<B>) => unknown, thisArg?: any) => number;
toReversed: () => Array<B>;
toSorted: (compareFn?: ((a: B, b: B) => number) | undefined) => Array<B>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<B>): Array<B>; (start: number, deleteCount?: number): Array<B> };
with: (index: number, value: B) => Array<B>;
}
out
})