React-native-iap: Types wrong in 3.5.1

Created on 30 Sep 2019  ·  4Comments  ·  Source: dooboolab/react-native-iap

Version of react-native-iap

3.5.1

Version of react-native

0.61.0

Platforms you faced the error (IOS or Android or both?)

both

Expected behavior

no type errors

Actual behavior

type errors on acknowledgePurchaseAndroid and requestSubscription. But maybe more.

Tested environment (Emulator? Real Device?)

emulator

Steps to reproduce the behavior

running the latest version and then do your type checking

Solution

requestSubscription = (sku: string, oldSku: string, prorationMode: number)

Should be:

requestSubscription = (sku: string, oldSku?: string, prorationMode?: number)

and...

acknowledgePurchaseAndroid = (token: string, developerPayload: string)

Should be:

acknowledgePurchaseAndroid = (token: string, developerPayload?: string)

I guess there are more of these little things now since the index.d.ts is gone and index.ts does not yet reflect those types. Don't have the time to go through them all at this moment. Just letting you know the types should be looked at :-)

❄️ types 🐛 bug

Most helpful comment

You guys are right. Sorry that I've missed this out. Today, I've just migrated our project to typescript since there are so many issues related to typings. Now we only need to concentrate on ts file and flow and js will be auto-generated.

I've released 3.5.2 for the fix.

All 4 comments

I'm facing the same problem, the fields oldSku and prorationMode of requestSubscription should be optional

You guys are right. Sorry that I've missed this out. Today, I've just migrated our project to typescript since there are so many issues related to typings. Now we only need to concentrate on ts file and flow and js will be auto-generated.

I've released 3.5.2 for the fix.

Thanks a lot @hyochan

Thanks @hyochan for the fast response. Will try it out soon!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

safciplak picture safciplak  ·  3Comments

Gribadze picture Gribadze  ·  4Comments

chetstone picture chetstone  ·  4Comments

ramondelmondo picture ramondelmondo  ·  4Comments

coldfins picture coldfins  ·  3Comments