capacitor-community / firebase-remote-config

MIT License
23 stars 38 forks source link

Getter methods on web plugin return wrong types #16

Open mic345 opened 3 years ago

mic345 commented 3 years ago

Describe the bug

Web version getter methods return different type (e.g. Promise<string|int|boolean>) than native versions (e.g. Promise<RCReturnData>).

To Reproduce

  1. Call FirebaseRemoteConfig.getString on web version => returns Promise<string>
  2. Call FirebaseRemoteConfig.getString on iOS version => returns Promise<RCReturnData>

Expected behavior

Return the same type regardless the platform.

marcuspocus commented 3 years ago

FirebaseRemoteConfig.getString should return Promise on all platform.

mic345 commented 3 years ago

It should return a Promise<type> with a consistent type and not Promise<string> on one platform and Promise<RCReturnData> on another...

marcuspocus commented 3 years ago

@mic345 Sorry for my first msg. It was badly formatted, and gh removed the <string> part...

But yes, that's what I'm saying, and specificaly: the Promise<type>, should NOT be Promise<RCReturnData> when the method is getString...

=> It should be Promise<String> for getString, and Promise<boolean> for getBoolean, etc...

Even getValue could use generic to return the type.

getValue<T>(key: string): Promise<T>;

Also, there is no use for passing an object in getter. Instead of getBoolean({key: string}): Promise<boolean>;, method should be getBoolean(key: string): Promise<boolean>; (same for others getter)

And you are right, it should be consistent for every platform, be it WEB or Android, or IOS.

mic345 commented 3 years ago

Sorry for my first msg.

No worries 😊