v2.8.1 Release - Type System Improvements
This release resolves type mismatches between Product and Purchase types across iOS and Android platforms.
What's Newโ
Type System Improvementsโ
- Added
platform
field to all types for runtime type discrimination - Moved common fields (
ids
,debugDescription
) to shared base types - Fixed iOS native code to populate missing subscription fields
No Breaking Changesโ
All existing code continues to work. Update to platform-specific field names before v2.9.0:
- Android:
name
โnameAndroid
- iOS:
displayName
โdisplayNameIOS
Important Noteโ
If upgrading from versions before v2.8.0, please review the v2.8.0 migration guide first, as it contains breaking changes for iOS field naming conventions.
Type Discrimination Exampleโ
import {Product, Purchase} from 'expo-iap';
function handleProduct(product: Product) {
if (product.platform === 'ios') {
// TypeScript knows this is ProductIOS
console.log(product.isFamilyShareableIOS);
} else if (product.platform === 'android') {
// TypeScript knows this is ProductAndroid
console.log(product.nameAndroid);
}
}
Installationโ
npm install expo-iap@2.8.1
Next Stepsโ
Deprecated fields will be removed in v2.9.0. Update your code now to ensure smooth migration.
For details, see the full changelog.