Skip to content

Commit e5165b1

Browse files
gcantieffect-bot
authored andcommitted
Add missing Either.void constructor (#4413)
1 parent 8755936 commit e5165b1

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

.changeset/thick-laws-yell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": minor
3+
---
4+
5+
Add missing `Either.void` constructor.

packages/effect/src/Either.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ export declare namespace Either {
118118
*/
119119
export const right: <R>(right: R) => Either<R> = either.right
120120

121+
const void_: Either<void> = right(void 0)
122+
export {
123+
/**
124+
* @category constructors
125+
* @since 3.13.0
126+
*/
127+
void_ as void
128+
}
129+
121130
/**
122131
* Constructs a new `Either` holding a `Left` value. This usually represents a failure, due to the right-bias of this
123132
* structure.

packages/effect/test/Either.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import {
1313
} from "effect/test/util"
1414

1515
describe("Either", () => {
16+
it("void", () => {
17+
deepStrictEqual(Either.void, Either.right(undefined))
18+
})
19+
1620
it("gen", () => {
1721
const a = Either.gen(function*() {
1822
const x = yield* Either.right(1)

0 commit comments

Comments
 (0)