Combines two Result values into a single Result containing a tuple. If either Result is Err, returns the first Err encountered.
Result
Err
The success type of the first Result.
The error type of the first Result.
The success type of the second Result.
The error type of the second Result.
The first Result.
The second Result.
A Result containing a tuple of both values, or the first Err.
const first = Result.ok('left');const second = Result.ok(1);const expected: readonly [string, number] = ['left', 1];assert.deepStrictEqual(Result.zip(first, second), Result.ok(expected));assert.deepStrictEqual( Result.zip(first, Result.err('error')), Result.err('error'),); Copy
const first = Result.ok('left');const second = Result.ok(1);const expected: readonly [string, number] = ['left', 1];assert.deepStrictEqual(Result.zip(first, second), Result.ok(expected));assert.deepStrictEqual( Result.zip(first, Result.err('error')), Result.err('error'),);
Combines two
Result
values into a singleResult
containing a tuple. If eitherResult
isErr
, returns the firstErr
encountered.