@@ -24,11 +24,11 @@ import type {
2424 FullMetadata ,
2525 ListResult ,
2626 ListOptions ,
27- TaskResult ,
2827 Task ,
2928 SettableMetadata ,
3029 UploadMetadata ,
3130 EmulatorMockTokenOptions ,
31+ UploadResult ,
3232} from './types/storage' ;
3333import { TaskEvent , TaskState } from './types/storage' ;
3434import type { StorageReferenceInternal , StorageInternal } from './types/internal' ;
@@ -269,17 +269,18 @@ export function updateMetadata(
269269
270270/**
271271 * Uploads data to this object's location. The upload is not resumable. If the upload is canceled,
272- * the Promise will reject with the TaskSnapshot. If there is an error it will reject with the StorageError
272+ * the Promise will reject with the {TaskSnapshot}. If there is an error it will reject with the StorageError,
273+ * but as a {ReactNativeFirebase.NativeFirebaseError} type
273274 * @param storageRef - Storage `Reference` instance.
274275 * @param data - The data (Blob | Uint8Array | ArrayBuffer) to upload to the storage bucket at the reference location.
275276 * @param metadata - A Storage `UploadMetadata` instance to update. Optional.
276- * @returns {Promise<TaskResult > }
277+ * @returns {Promise<UploadResult > }
277278 */
278279export async function uploadBytes (
279280 storageRef : StorageReference ,
280281 data : Blob | Uint8Array | ArrayBuffer ,
281282 metadata ?: UploadMetadata ,
282- ) : Promise < TaskResult > {
283+ ) : Promise < UploadResult > {
283284 const task = uploadBytesResumable ( storageRef , data , metadata ) ;
284285 return new Promise ( ( resolve , reject ) => {
285286 task . on (
@@ -289,6 +290,7 @@ export async function uploadBytes(
289290 case TaskState . RUNNING :
290291 break ;
291292 case TaskState . PAUSED :
293+ // we are wrapping the resumable version, just resume if it pauses
292294 task . resume ( ) ;
293295 break ;
294296 case TaskState . SUCCESS :
@@ -299,7 +301,7 @@ export async function uploadBytes(
299301 reject ( taskSnapshot ) ;
300302 break ;
301303 case TaskState . ERROR :
302- // this will be handled in the dedicated error listener
304+ // this is handled in the dedicated error listener below
303305 break ;
304306 default :
305307 throw new Error ( `Unhandled task state in uploadBytes: ${ taskSnapshot . state } ` ) ;
0 commit comments