Getting S3 Multipart Key in upload-success event

Hello there,
When using the aws-s3-multipart uploader with uppy I am unable to get the upload key in the upload-success event without calling Uppy.getFile.

For example I can get the key with the following(with a typescript error that s3Multipart does not exist even though does)

function uploadSuccess(file: UppyFile, response: any){
  uppy.getFile(file.id).s3Multipart.key,
}

But I cannot get it with

file.s3Multipart.key

As s3Multipart is not available on the passed in file.

Does anyone know of a better way to get the newly uploaded files key without typescript errors?

I’m not sure if there is a better way to achieve this (I’ll keep looking), but the way I thought of is similar to this:

interface S3MultipartFile extends UppyFile {
  s3Multipart: {
    key: string;
  }
}
function uploadSuccess(file: UppyFile, response: any){
  (uppy.getFile(file.id) as S3MultipartFile).s3Multipart.key,
}

This uses type assertions. It’s worth noting that you could also use a type assertion as any or use // @ts-ignore instead. However, neither of these approaches yield the benefits of strong typing

If there are any additional properties that you’d need to access, you should be able to add them to the S3MultipartFile interface.

This should work. Let me know if you have any problems or further questions

- Andrew