react-native-iap
react-native-iap copied to clipboard
Android Types do not match underlying objects
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 propertytype
does not exist on Android. Instead, onlyproductType
exists during runtime. -
Product
/ Android: thelocalizedPrice
property exists during runtime, but not on the typescript types.
See images below.
Screenshots
Environment:
- react-native-iap: 12.10.5
- react-native: 0.71
- Android
same here
+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,