#joshualaba

1 messages · Page 1 of 1 (latest)

orchid krakenBOT
gentle stratus
#

👋 how may I help?

tulip nacelle
#

hello... i need some help. previously i did not encounter this error on "stripe": "11.9.1", but currently on "stripe": "^13.4.0", i am having the following issue:

#

import { Stripe } from 'stripe';

export type PaymentEvent = Stripe.Event;

event: PaymentEvent

When I enter: event.data.object.id

Property 'id' does not exist on type 'Object'.

gentle stratus
#

would you mind elaborating please?

tulip nacelle
#

i am getting shown the above error that id does not exist on type object?

#

for the new stripe version 13.4

#

is there somethign wrong with the packge

gentle stratus
#

would you mind sharing your code?

tulip nacelle
#

it is exactly as i sentt u?

#

import { Stripe } from 'stripe';

export type PaymentEvent = Stripe.Event;

func1(event: PaymentEvent) {
console.log(event.data.object.id)
}

Error: Property 'id' does not exist on type 'Object'.

gentle stratus
#

you need to cast event.data.object to the corresponding Stripe object type

#

based on the event.type

tulip nacelle
#

ah okay

#

so i need to manually cast because ts currently cant do the inference

#

?

gentle stratus
#

yes

tulip nacelle
#

alright cool,anyway this works thank you

gentle stratus
#

let me know if you need any more help