appwrite/sdk-for-web

Some TypeScript Definitions incorrectly have have parameters that are non-optional when they should be optional

PineappleIOnic opened this issue · 4 comments

For example, The storage.listFiles() function should have all optional parameters, while instead all of them are non-optional.

The code for this particular issue is here:
https://github.com/appwrite/sdk-for-js/blob/3f71ea130d6c91ea484f9de821a9ec74345d4160/types/index.d.ts#L582

This should be replaced with

listFiles(search?: string, limit?: number, offset?: number, orderType?: string): Promise<object>;

Which will make all the parameters optional, allowing the function to be used just to list all the files.

Over the coming days, I'll take a look at index.d.ts more closely and try to find a couple more instances of this occurring.

This issue will be fixed when appwrite/sdk-generator#64 is merged.

Actually every method that has an optional parameter was not really optional, because there was no dedicated logic to that. After the mentioned PR is merged optional parameters will be correctly set.

I had a feeling that would have been the case, that's why I was going to look around for them but the fix for the SDK Generator thanks to you should fix it all 👍

I'm going to close this issue now since the PR has been merged and the issue has been resolved.