Skip to content

Commit 1df2927

Browse files
committed
fix: type narrowing for isErr and isOk not working
1 parent cf8973f commit 1df2927

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/result.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function err<E>(error: E): Result<never, E> {
6363
*/
6464
export function isOk<T, E>(
6565
result: Result<T, E>,
66-
): result is { _tag: "Ok"; value: T } {
66+
): result is Extract<Result<T, E>, { _tag: "Ok" }> {
6767
return result._tag === "Ok";
6868
}
6969

@@ -90,7 +90,7 @@ export function isOk<T, E>(
9090
*/
9191
export function isErr<T, E>(
9292
result: Result<T, E>,
93-
): result is { _tag: "Err"; error: E } {
93+
): result is Extract<Result<T, E>, { _tag: "Err" }> {
9494
return result._tag === "Err";
9595
}
9696

0 commit comments

Comments
 (0)