#Dave

1 messages · Page 1 of 1 (latest)

half lagoonBOT
safe owl
#

Hi 👋 can you tell me more about how you're handling typing? Are you relying on the typing in one of our provided libraries?

dense mural
#

In my package.json I have stripe and @stripe/stripe-js installed.

I use let event: Stripe.Event;

In my POST request I have a switch statement which is looking at event.type, and then my session object is constructed using const session = event.data.object as Stripe.Checkout.Session;

All of the other keys in the object work fine, other than session.shipping.

Here is a simplified version of the code I'm running: https://pastebin.com/ntR0XbZU Line 24 is where I get the typescript error. Everything else is fine.

#

I could extend the Stripe.Checkout.Session interface, but I figure it's best to first see if I'm doing something wrong

safe owl
#

Taking a closer look, trying to see if I can find the current list of the contents for Checkout Sessions.

dense mural
#

Thanks!

safe owl
dense mural
#

That seems to return undefined...

#

Wierd. Never mind, I've got to run, so I'll just extend the interface for now - as that works fine. I just wanted to make sure I wasn't missing anything obvious and can pick this up again if needed. Thanks so much for your help!