Skip to content

Commit

Permalink
Stronger type checking for runAsync
Browse files Browse the repository at this point in the history
Use more specific types in the runAsync function so that the compiler will complain if anything isn’t right.
  • Loading branch information
danieljbruce committed Nov 23, 2023
1 parent a9fcb56 commit 8ed092e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,9 @@ class Transaction extends DatastoreRequest {
*
*
**/
async #runAsync(options: RunOptions): Promise<UserCallbackData<any>> {
async #runAsync(
options: RunOptions
): Promise<UserCallbackData<google.datastore.v1.IBeginTransactionResponse>> {
const reqOpts: RequestOptions = {
transactionOptions: {},
};
Expand All @@ -777,8 +779,10 @@ class Transaction extends DatastoreRequest {
if (options.transactionOptions) {
reqOpts.transactionOptions = options.transactionOptions;
}
const promiseFunction: Resolver<any> = (
resolve: PromiseResolveFunction<any>
const promiseFunction: Resolver<
google.datastore.v1.IBeginTransactionResponse
> = (
resolve: PromiseResolveFunction<google.datastore.v1.IBeginTransactionResponse>
) => {
this.request_(
{
Expand Down

0 comments on commit 8ed092e

Please sign in to comment.