From d3afa85e90981361a3e9f3c60ba5e2008e5083c4 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Tue, 5 Mar 2024 15:12:28 +0100 Subject: [PATCH] Allow typing fromPromise --- src/Future.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Future.ts b/src/Future.ts index c1e638b..95a9128 100644 --- a/src/Future.ts +++ b/src/Future.ts @@ -28,11 +28,13 @@ export class Future { /** * Converts a Promise to a Future\> */ - static fromPromise(promise: Promise): Future> { + static fromPromise( + promise: Promise, + ): Future> { return Future.make((resolve) => { promise.then( (ok) => resolve(Result.Ok(ok)), - (reason) => resolve(Result.Error(reason)), + (error: E) => resolve(Result.Error(error)), ); }); }