From 618d8bda51d23f4f294242087fff89e965560658 Mon Sep 17 00:00:00 2001 From: yifanwww Date: Tue, 12 Nov 2024 23:21:23 +0800 Subject: [PATCH] refactor: don't use NonNullable --- packages/result/src/Result.ts | 2 +- packages/result/src/ResultAsync.ts | 2 +- packages/result/src/RustlikeResult.ts | 2 +- packages/result/src/RustlikeResultAsync.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/result/src/Result.ts b/packages/result/src/Result.ts index 74a722b..4b64150 100644 --- a/packages/result/src/Result.ts +++ b/packages/result/src/Result.ts @@ -577,7 +577,7 @@ export interface Result { * * ref: https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose */ - transpose(): Optional, E>>; + transpose(): Optional>; /** * Returns `true` if `self` equals to `other`. diff --git a/packages/result/src/ResultAsync.ts b/packages/result/src/ResultAsync.ts index 8c9c9b1..5f18295 100644 --- a/packages/result/src/ResultAsync.ts +++ b/packages/result/src/ResultAsync.ts @@ -583,7 +583,7 @@ export interface ResultAsync extends PromiseLike> { * * ref: https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose */ - transpose(): Promise, E>>>; + transpose(): Promise>>; /** * Asynchronously returns `true` if `self` equals to `other`. diff --git a/packages/result/src/RustlikeResult.ts b/packages/result/src/RustlikeResult.ts index 07c06f9..3a3c62d 100644 --- a/packages/result/src/RustlikeResult.ts +++ b/packages/result/src/RustlikeResult.ts @@ -151,7 +151,7 @@ export class RustlikeResult implements Result { return this.isOk() ? RustlikeResult.Ok(this._value!) : op(this._error!); } - transpose(): Optional, E>> { + transpose(): Optional> { if (this.isOk()) { return this._value === undefined || this._value === null ? undefined : RustlikeResult.Ok(this._value); } diff --git a/packages/result/src/RustlikeResultAsync.ts b/packages/result/src/RustlikeResultAsync.ts index 17026aa..7bdb88a 100644 --- a/packages/result/src/RustlikeResultAsync.ts +++ b/packages/result/src/RustlikeResultAsync.ts @@ -150,7 +150,7 @@ export class RustlikeResultAsync implements ResultAsync { ); } - transpose(): Promise, E>>> { + transpose(): Promise>> { return this._promise.then((result) => result.transpose()); }