supabase / storage-js

JS Client library to interact with Supabase Storage
Apache License 2.0
129 stars 39 forks source link

data.id (still) missing for data return type / upload function #198

Open mikelieser opened 6 months ago

mikelieser commented 6 months ago

Bug report

Describe the bug

I get a type error after uploading a file, as "id" is not defined in current version 2.5.5 return data type for the upload function.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

const { data } = await supabase.storage
      .from("bucket_name")
      .upload(
        `filename`,
        fileData
      );
    if (data) {
      const fileId = data.id; // <<< Property 'id' does not exist on type '{ path: string; }'.ts(2339)
    }

Result: Property 'id' does not exist on type '{ path: string; }'.ts(2339)

Expected behavior

Screenshots

version 2.5.5 type definition

Bildschirmfoto 2024-04-24 um 10 41 02

v2.5.5 code (latest version) https://github.com/supabase/storage-js/blob/v2.5.5/src/packages/StorageFileApi.ts#L141

main code: https://github.com/supabase/storage-js/blob/main/src/packages/StorageFileApi.ts#L142

It looks like something did not work as planned as there are commits fixing the upload return type: https://github.com/supabase/storage-js/commits/v2.5.5

in main the code is fine since this commit Dec 19 2023: https://github.com/supabase/storage-js/commit/68a61973a4bdaa36a41014679108add89717bb38

So I guess you just need to release v2.5.6 to fix it again 😄 Thanks.

System information

Additional context

Add any other context about the problem here.

mikelieser commented 6 months ago

older issue: https://github.com/supabase/storage-js/issues/170 PR fix in the past: https://github.com/supabase/storage-js/pull/168

npm code v2.5.5: https://www.npmjs.com/package/@supabase/storage-js?activeTab=code

Bildschirmfoto 2024-04-24 um 10 59 07