firebase-remote-config icon indicating copy to clipboard operation
firebase-remote-config copied to clipboard

Getter methods on web plugin return wrong types

Open mic345 opened this issue 5 years ago • 4 comments

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.

mic345 avatar Dec 10 '20 22:12 mic345

FirebaseRemoteConfig.getString should return Promise on all platform.

marcuspocus avatar Feb 18 '21 14:02 marcuspocus

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

mic345 avatar Feb 18 '21 15:02 mic345

@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.

marcuspocus avatar Feb 18 '21 16:02 marcuspocus

Sorry for my first msg.

No worries 😊

mic345 avatar Feb 19 '21 16:02 mic345