#-charmines_code
1 messages · Page 1 of 1 (latest)
👋 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.
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
Which language is that (sorry)
Typescript
Maybe some cache issue on VSCode? PaymentIntent is surely a type
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
https://github.com/stripe/stripe-node/blob/master/types/PaymentIntents.d.ts suppose you are using this
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
Can you share in text what you want to achieve?
In a code block like this
const paymentIntent = await stripe.paymentIntents.create
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
don't you want PaymentIntent.Status instead (Uppercase S)?
Yes but given that PaymentIntent does not appear to exist/work at all it does not change
PaymentIntent without the "s"
Same thing
These are all the types I have
http://sharex.charmines.dev/JxBn
under Payment
None of those work either
What do you have inside PaymentIntentResource btw
Just the normal stuff for a class
http://sharex.charmines.dev/Hv37
I do not have it without an s if that was purposeful
do you have .create
No
Let's restart from scratch. Can you delete the package and try to download/import it again?
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';
How about downloading the sample here and try in a separated folder? =
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
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
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
I see, are you not using React or Next.js? Just purely typescript?
Yep purely typescript
Ah sorry that's frontend
hmm
How about cloning the SDK repo and run this example folder: https://github.com/stripe/stripe-node/tree/master/examples/snippets
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?
You can just create a new thread, you will have the link the this past thread