Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ class Transaction extends DatastoreRequest {
* transaction.
*
* @param {CallOptions | https://googleapis.github.io/gax-nodejs/global.html#CallOptions} [gaxOptions] Request configuration options.
* @param {function} callback The callback function.
* @param {?error} callback.err An error returned while making this request.
* If the commit fails, we automatically try to rollback the transaction
* (see {module:datastore/transaction#rollback}).
* @param {object} callback.apiResponse The full API response.
* @returns {Promise<CommitResponse>} The full API response.
*
* @example
* ```
Expand All @@ -159,16 +155,26 @@ class Transaction extends DatastoreRequest {
*/
commit(gaxOptions?: CallOptions): Promise<CommitResponse>;
/**
* @param {object} [gaxOptions] Request configuration options, outlined here:
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions.
* @param {object} [gaxOptions] Request configuration options.
* See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions CallOptions Docs}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the * @param {object} [gaxOptions] parameter can be eliminated entirely because its not in the following commit(callback: CommitCallback) signature?

* @param {function} callback The callback function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function can be replaced with the more specific CommitCallback type.

* @param {?error} callback.err An error returned while making this request.
* If the commit fails, we automatically try to rollback the transaction
* (see {module:datastore/transaction#rollback}).
* @param {object} callback.apiResponse The full API response.
*/
commit(callback: CommitCallback): void;
/**
* @param {CallOptions} [gaxOptions] Request configuration options.
* See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions CallOptions Docs}.
* @param {CommitCallback} callback The callback function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: callback should probably be [callback].

*/
commit(gaxOptions: CallOptions, callback: CommitCallback): void;
/**
* @param {CallOptions} [gaxOptionsOrCallback] Request configuration options.
* See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions CallOptions Docs}.
* @param cb The callback function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We should probably add {CommitCallback} here so that the parameter has a type. Also we should wrap cb in square brackets. ie. [cb].

*/
commit(
gaxOptionsOrCallback?: CallOptions | CommitCallback,
cb?: CommitCallback,
Expand Down
Loading