Skip to content

Commit

Permalink
refactor: don't use NonNullable<unknown>
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanwww committed Nov 12, 2024
1 parent 6187902 commit 618d8bd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/result/src/Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ export interface Result<T, E> {
*
* ref: https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose
*/
transpose(): Optional<Result<T & NonNullable<unknown>, E>>;
transpose(): Optional<Result<T & {}, E>>;

/**
* Returns `true` if `self` equals to `other`.
Expand Down
2 changes: 1 addition & 1 deletion packages/result/src/ResultAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export interface ResultAsync<T, E> extends PromiseLike<Result<T, E>> {
*
* ref: https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose
*/
transpose(): Promise<Optional<Result<T & NonNullable<unknown>, E>>>;
transpose(): Promise<Optional<Result<T & {}, E>>>;

/**
* Asynchronously returns `true` if `self` equals to `other`.
Expand Down
2 changes: 1 addition & 1 deletion packages/result/src/RustlikeResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class RustlikeResult<T, E> implements Result<T, E> {
return this.isOk() ? RustlikeResult.Ok(this._value!) : op(this._error!);
}

transpose(): Optional<Result<T & NonNullable<unknown>, E>> {
transpose(): Optional<Result<T & {}, E>> {
if (this.isOk()) {
return this._value === undefined || this._value === null ? undefined : RustlikeResult.Ok(this._value);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/result/src/RustlikeResultAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class RustlikeResultAsync<T, E> implements ResultAsync<T, E> {
);
}

transpose(): Promise<Optional<Result<T & NonNullable<unknown>, E>>> {
transpose(): Promise<Optional<Result<T & {}, E>>> {
return this._promise.then((result) => result.transpose());
}

Expand Down

0 comments on commit 618d8bd

Please sign in to comment.