react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

Android Types do not match underlying objects

Open rodperottoni opened this issue 11 months ago • 2 comments

Description

The Product and Subscription types in the latest version do not match the underlying objects returned by the native layer.

Expected Behavior

The type definitions should at least reflect the real object shapes. See images below for discrepancies. More specifically:

  • Product / Android: the property type does not exist on Android. Instead, only productType exists during runtime.
  • Product / Android: the localizedPrice property exists during runtime, but not on the typescript types.

See images below.

Screenshots

Screenshot 2023-08-01 at 3 39 42 pm Screenshot 2023-08-01 at 3 40 05 pm

Environment:

  • react-native-iap: 12.10.5
  • react-native: 0.71
  • Android

rodperottoni avatar Aug 01 '23 18:08 rodperottoni

same here

kauesedrez avatar Oct 08 '23 14:10 kauesedrez

+1

for now, I've had to extend the base type:

interface RNIAPProductExt extends Product {
  productType: "subs" | "sub" | "inapp" | "iap"
}

and null coalesce either when storing:

type: product.type ?? product.productType,

phil-hudson avatar Jan 18 '24 03:01 phil-hudson