Skip to content

TypeScript types for Purchases.getOfferings() don't match runtime return value #657

@anthonyhenhawk

Description

@anthonyhenhawk

SDK: @revenuecat/purchases-capacitor@11.3.2

Description:

The TypeScript types for Purchases.getOfferings() indicate it returns PurchasesOfferings directly, but
at runtime it actually returns { offerings: PurchasesOfferings }.

Expected (per TypeScript types):
const offerings: PurchasesOfferings = await Purchases.getOfferings();
console.log(offerings.current); // Should work

Actual runtime behavior:
const result = await Purchases.getOfferings();
// result is actually { offerings: PurchasesOfferings }
// so result.current is undefined
// must access result.offerings.current

Workaround:
const result = await Purchases.getOfferings();
const offerings = ('offerings' in result)
? (result as any).offerings as PurchasesOfferings
: result;

Impact:

This causes offerings.current and offerings.all to be undefined when following the TypeScript types,
resulting in empty package lists and broken subscription flows.

Environment:

  • @revenuecat/purchases-capacitor: 11.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions