Skip to content

Commit

Permalink
test: Be more specific in purchaseErrorListener param typing (#1101)
Browse files Browse the repository at this point in the history
* test: Be more specific in purchaseErrorListener param typing

* fix: Type listener correctly as function, not as event
  • Loading branch information
Amaury Liet authored Sep 14, 2020
1 parent e433408 commit 8240bc4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,16 +686,16 @@ export const validateReceiptAndroid = async (
* @returns {callback(e: InAppPurchase | ProductPurchase)}
*/
export const purchaseUpdatedListener = (
e: InAppPurchase | SubscriptionPurchase | any,
listener: (event: InAppPurchase | SubscriptionPurchase) => void,
): EmitterSubscription => {
if (Platform.OS === 'ios') {
checkNativeiOSAvailable();
const myModuleEvt = new NativeEventEmitter(RNIapIos);
return myModuleEvt.addListener('purchase-updated', e);
return myModuleEvt.addListener('purchase-updated', listener);
} else {
const emitterSubscription = DeviceEventEmitter.addListener(
'purchase-updated',
e,
listener,
);
RNIapModule.startListening();
return emitterSubscription;
Expand All @@ -707,14 +707,14 @@ export const purchaseUpdatedListener = (
* @returns {callback(e: PurchaseError)}
*/
export const purchaseErrorListener = (
e: PurchaseError | any,
listener: (errorEvent: PurchaseError) => void,
): EmitterSubscription => {
if (Platform.OS === 'ios') {
checkNativeiOSAvailable();
const myModuleEvt = new NativeEventEmitter(RNIapIos);
return myModuleEvt.addListener('purchase-error', e);
return myModuleEvt.addListener('purchase-error', listener);
} else {
return DeviceEventEmitter.addListener('purchase-error', e);
return DeviceEventEmitter.addListener('purchase-error', listener);
}
};

Expand Down

0 comments on commit 8240bc4

Please sign in to comment.