Skip to content

Commit 55b26a6

Browse files
gcantimikearnaldi
authored andcommittedFeb 21, 2024
Either: fix fromOption overloads order (#2194)
1 parent 136ef40 commit 55b26a6

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
 

‎.changeset/mighty-horses-begin.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": patch
3+
---
4+
5+
Either: fix `fromOption` overloads order

‎packages/effect/src/Either.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ export const fromNullable: {
142142
* @since 2.0.0
143143
*/
144144
export const fromOption: {
145-
<R, L>(self: Option<R>, onNone: () => L): Either<R, L>
146145
<L>(onNone: () => L): <R>(self: Option<R>) => Either<R, L>
146+
<R, L>(self: Option<R>, onNone: () => L): Either<R, L>
147147
} = either.fromOption
148148

149149
const try_: {

‎packages/effect/src/internal/either.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export const getRight = <R, L>(
100100
): Option<R> => (isLeft(self) ? option.none : option.some(self.right))
101101

102102
/** @internal */
103-
export const fromOption = dual(
103+
export const fromOption: {
104+
<L>(onNone: () => L): <R>(self: Option<R>) => Either.Either<R, L>
105+
<R, L>(self: Option<R>, onNone: () => L): Either.Either<R, L>
106+
} = dual(
104107
2,
105108
<R, L>(self: Option<R>, onNone: () => L): Either.Either<R, L> =>
106109
option.isNone(self) ? left(onNone()) : right(self.value)

0 commit comments

Comments
 (0)
Please sign in to comment.