#-charmines_code

1 messages · Page 1 of 1 (latest)

cedar galeBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1328979669621542928

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

zealous finch
#

Hey there, I am having this issue where I have imported Stripe and am attempting to use it in typescript but the types dont appear to work for some reason?

See here where the Stripe.PaymentIntent type is used by the module
http://sharex.charmines.dev/RAuU

And here where it does not appear to exist
http://sharex.charmines.dev/gtT2

spiral star
#

Which language is that (sorry)

zealous finch
#

Typescript

spiral star
#

Maybe some cache issue on VSCode? PaymentIntent is surely a type

zealous finch
#

Not sure, I reloaded vscode and the issue persists

#

I will dive a little deeper

#

But it doesnt seem that a fair amount of types are there

spiral star
zealous finch
#

I do seem to have that file

#

Although im not entirely sure what using it would look like

#

Closing and reopening the VSCode window also does not appear to change anything

spiral star
#

Can you share in text what you want to achieve?

#

In a code block like this

const paymentIntent = await stripe.paymentIntents.create
zealous finch
#
    const paymentIntent = await stripe.paymentIntents.create(paymentIntentCreateParams);
    if (paymentIntent.status == Stripe.PaymentIntents.status.SOME_ENUM_VALUE)
#

I have also ruled out a VSCode issue, it will not compile either

spiral star
#

don't you want PaymentIntent.Status instead (Uppercase S)?

zealous finch
#

Yes but given that PaymentIntent does not appear to exist/work at all it does not change

spiral star
#

PaymentIntent without the "s"

zealous finch
#

Same thing

#

under Payment

spiral star
#

How about Stripe.Invoice?

#

or Stripe.Charge

zealous finch
#

None of those work either

spiral star
#

What do you have inside PaymentIntentResource btw

zealous finch
#

I do not have it without an s if that was purposeful

spiral star
#

do you have .create

zealous finch
#

No

spiral star
#

Let's restart from scratch. Can you delete the package and try to download/import it again?

zealous finch
#

I actually just did an npm uninstall stripe and npm i stripe to no effect

#

And my import looks like this import Stripe from 'stripe';

#

I have also attempted a non default import import { Stripe } from 'stripe';

spiral star
#

How about downloading the sample here and try in a separated folder? =

zealous finch
#

Given that it is js that would probably work given the issue is types

#

The pieces of code used for the example does also appear to be code that does work

#

I can still try it if you want but it feels like that would be a waste of time

spiral star
#

If you can prove the samples work, then you can start modifying the samples code with your status comparison

#

We want to start from something works

zealous finch
#

That makes sense but I dont entirely understand because I would be changing languages more or less

#

There is no javascript equivalent of the erroring code

#

If you have a typescript version of the example that might be good to try but to me switching languages and import types seems like a large jump from the actual issue

spiral star
#

I see, are you not using React or Next.js? Just purely typescript?

zealous finch
#

Yep purely typescript

spiral star
#

Ah sorry that's frontend

#

hmm

zealous finch
#

Seems like a better example to add but also doesn't seem like it would be particularly helpful

#

For the point of example I could probably get working code to call the api but it's once I need these types that it doesn't seem to work

#

I will be heading off to sleep now, is there something I need to do when I return to bump my thread back up?

spiral star
#

You can just create a new thread, you will have the link the this past thread