Skip to content

Commit

Permalink
Use Promise as return type for call.then() (timostamm#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored May 16, 2022
1 parent 44b0fe4 commit 76a4e50
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/runtime-rpc/src/client-streaming-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class ClientStreamingCall<I extends object = object, O extends object = o
then<TResult1 = FinishedClientStreamingCall<I, O>, TResult2 = never>(
onfulfilled?: ((value: FinishedClientStreamingCall<I, O>) => (PromiseLike<TResult1> | TResult1)) | undefined | null,
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | undefined | null
): PromiseLike<TResult1 | TResult2> {
): Promise<TResult1 | TResult2> {
return this.promiseFinished().then(
value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value as unknown as TResult1,
reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-rpc/src/duplex-streaming-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class DuplexStreamingCall<I extends object = object, O extends object = o
then<TResult1 = FinishedDuplexStreamingCall<I, O>, TResult2 = never>(
onfulfilled?: ((value: FinishedDuplexStreamingCall<I, O>) => (PromiseLike<TResult1> | TResult1)) | undefined | null,
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | undefined | null
): PromiseLike<TResult1 | TResult2> {
): Promise<TResult1 | TResult2> {
return this.promiseFinished().then(
value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value as unknown as TResult1,
reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-rpc/src/server-streaming-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class ServerStreamingCall<I extends object = object, O extends object = o
then<TResult1 = FinishedServerStreamingCall<I, O>, TResult2 = never>(
onfulfilled?: ((value: FinishedServerStreamingCall<I, O>) => (PromiseLike<TResult1> | TResult1)) | undefined | null,
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | undefined | null
): PromiseLike<TResult1 | TResult2> {
): Promise<TResult1 | TResult2> {
return this.promiseFinished().then(
value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value as unknown as TResult1,
reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-rpc/src/unary-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class UnaryCall<I extends object = object, O extends object = object> imp
then<TResult1 = FinishedUnaryCall<I, O>, TResult2 = never>(
onfulfilled?: ((value: FinishedUnaryCall<I, O>) => (PromiseLike<TResult1> | TResult1)) | undefined | null,
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | undefined | null
): PromiseLike<TResult1 | TResult2> {
): Promise<TResult1 | TResult2> {
return this.promiseFinished().then(
value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value as unknown as TResult1,
reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
Expand Down

0 comments on commit 76a4e50

Please sign in to comment.