stripe / stripe-node

Node.js library for the Stripe API.
https://stripe.com
MIT License
3.9k stars 756 forks source link

Type Stripe.Subscription don't show attribute plan #2127

Closed kurybr closed 5 months ago

kurybr commented 5 months ago

Describe the bug

There is a problem with the typing of Stripe.Subscription. The plan object within the subscription is not being properly recognized.

To Reproduce

Try to access the plan object within Stripe.Subscription in a TypeScript environment. Observe that the typing does not recognize or consider the plan object.

Expected behavior

The typing for Stripe.Subscription should include and properly recognize the plan object with its structure and properties.

Code snippets

The plan object has the following structure:

plan: {
    id: string,
    object: string,
    active: boolean,
    aggregate_usage: any,
    amount: number,
    amount_decimal: string,
    billing_scheme: string,
    created: number,
    currency: string,
    interval: string,
    interval_count: number,
    livemode: boolean,
    metadata: object,
    meter: any,
    nickname: string,
    product: string,
    tiers_mode: any,
    transform_usage: any,
    trial_period_days: any,
    usage_type: string
}

OS

linux

Node version

v22.3.0

Library version

stripe-node 16.1.0

API version

2024-06-20

Additional context

remi-stripe commented 5 months ago

@kurybr plan as a property on Subscription has been deprecated for many years now. It exists for backwards compatibility reasons that I described in details in https://github.com/stripe/stripe-node/issues/1794 if you want a detailed answer! We recommend using items.data[][price] instead!