appwrite / sdk-for-web

[READ-ONLY] Official Appwrite Web SDK 🧡
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
273 stars 59 forks source link

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

Closed PineappleIOnic closed 3 years ago

PineappleIOnic commented 3 years ago

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.

PineappleIOnic commented 3 years ago

This issue will be fixed when https://github.com/appwrite/sdk-generator/pull/64 is merged.

benceHornyak commented 3 years ago

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.

PineappleIOnic commented 3 years ago

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 👍

PineappleIOnic commented 3 years ago

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