diff --git a/trycat.ts b/trycat.ts index 85f45d6..a67f14a 100644 --- a/trycat.ts +++ b/trycat.ts @@ -340,9 +340,9 @@ function err(error?: TErr): Err | Err { * Calls the given function, catches any thrown error into an {@link Err}, * and wraps the returned value with an {@link Ok} if nothing goes wrong. */ -function trys(fn: () => void): Result function trys(fn: () => T): Result -function trys(fn: () => T | undefined): Result | Result { +function trys(fn: () => void): Result +function trys(fn: () => T | undefined): Result | Result { try { const retval = fn() return retval ? ok(retval) : ok()