googleapis / nodejs-storage

Node.js client for Google Cloud Storage: unified object storage for developers and enterprises, from live data serving to data analytics/ML to data archiving.
https://cloud.google.com/storage/
Apache License 2.0
891 stars 367 forks source link

file.move return type (MoveResponse) is mostly un-typed #2364

Open mgabeler-lee-6rs opened 8 months ago

mgabeler-lee-6rs commented 8 months ago

Environment details

Steps to reproduce

  1. Install the library
  2. Observe the Promise-ified return type of file.move

The MoveResponse type (defined at https://github.com/googleapis/nodejs-storage/blob/v7.6.0/src/file.ts#L266) is just [unknown]. This doesn't seem correct, and is certainly unhelpful.

From the definition of MoveCallback (at https://github.com/googleapis/nodejs-storage/blob/v7.6.0/src/file.ts#L268-L274), it seems like it should be something like [File, unknown] matching destinationFile, apiResponse for the non-error version of the callback args.

ddelgrosso1 commented 8 months ago

Thanks for opening an issue @mgabeler-lee-6rs. We are in the process of cleaning up / more strongly typing things within the library. Looking back at the history MoveResponse was originally [Metadata] where Metadata = any. There are quiet a few places where the callback versions don't necessarily align with the promisified version. We intend to clean those up as well. Unfortunately, more strongly typing things / changing signatures are a breaking change that will have to wait until the next major revision of the library.