#gabor

1 messages · Page 1 of 1 (latest)

gusty breachBOT
dense delta
#

Hi, what is the exact error?

#

Can you share way more details here?

sinful karma
#

Hi, this is the TS error:

Type 'import("stripe").Stripe.SubscriptionSchedule.Phase' is not assignable to type 'import("stripe").Stripe.SubscriptionScheduleUpdateParams.Phase'.
  Types of property 'add_invoice_items' are incompatible.
    Type 'import("stripe").Stripe.SubscriptionSchedule.Phase.AddInvoiceItem[]' is not assignable to type 'import("stripe").Stripe.SubscriptionScheduleUpdateParams.Phase.AddInvoiceItem[]'.
      Type 'import("stripe").Stripe.SubscriptionSchedule.Phase.AddInvoiceItem' is not assignable to type 'import("stripe").Stripe.SubscriptionScheduleUpdateParams.Phase.AddInvoiceItem'.
        Types of property 'price' are incompatible.
          Type 'string | Price | DeletedPrice' is not assignable to type 'string | undefined'.
            Type 'Price' is not assignable to type 'string'.ts(2322)
#

As far as I understand there is a conflict between the schedule.phases I'm trying to include with the spread operator and what stripe.subscriptionSchedules.update expects.

#

subscription is a result of a query with stripe.subscriptions.retrieve(), expanded with the schedule object.

dense delta
#

We suspect that the schedule returned is just raw JSON so you would need to cast each parameter to it's corresponding type.

sinful karma
#

Oh, that makes sense! Thank you!

#

Although TS says subscription.schedule is string | Stripe.SubscriptionSchedule

#

and schedule.phases is Stripe.SubscriptionSchedule.Phase[]

dense delta
sinful karma
#

Thanks. Apart from types, is my base concept of including the existing phases and adding new ones like that correct?

dense delta