-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide an API version constant for the types #483
Comments
Thanks for the question. This is an interesting idea. How would the use of a version export work within your codebase? I'm not sure I understand how you would like to use this information. If you hardcode an old version of the Stripe API and try to use a new version of the TypeScript definitions with incompatible types, then |
Ah the issue is that our version of stripe-js is continually updated by Dependabot, but we have no way to know whether the API version has been updated at the same time. We'd like to ensure that the API version and the types are always in lockstep. It seems that is most easily achieved by getting the API version from this library, alongside the types. We then pass the API version to our backend when generating ephemeral keys, and we'd provide it into Also for general context, we use stripe-js in an Expo app, and the same single piece of code also uses stripe-react-native and exposes a single consistent interface (basically |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
What 😂 @fruchtose-stripe Could you please reopen? The bot ignored the bump |
Sorry about that, I forgot to remove the stale label. |
Does it work for you to import a constant type of the latest version? If so, you can do this: import type {Stripe} from 'stripe';
type LatestApiVersion = Stripe.LatestApiVersion; |
That sounds helpful, but the actual types are separate from the ones in this package. The key thing we need is the API version that was used to generate the types in this package |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale :\ |
@billinghamj sorry for getting back to you late. Our team is actively trying to find the best solution that works for you and also for our library. We're trying to better understand what your use case is. I'm going to try to explain what I understand but feel free to correct me if I am wrong. Context Problem
If you are passing in an Please let me know if I've understood your problem correctly. If so, I've provided some potential solutions below. Solutions
Let me know if any of these work for your use-case, if not we'd be happy to take another look at it :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sorry I think I missed your response! Yes that's right, and indeed we're keen on solution #1 Solution #2 I think doesn't resolve the issue, because Stripe has backend APIs that require you to specify the API version - e.g. for the customer ephemeral key. (I appreciate that stripe-js doesn't use that currently, but stripe-react-native does, and we are using them together in a single Expo integration.) Solution #3 is a fair point, though when Dependabot opens a PR with a major update to stripe-js, we'd still need to remember that there's something else we need to keep in sync. I don't think it's likely it'd be clear that was a key dependency without it being consistently called out in the list of breaking changes |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
The readme mentions:
It'd be helpful if there was an exported constant providing that version, to ensure we don't hardcode the current version, having the types move to a new version, and unknowingly having a mismatch
The text was updated successfully, but these errors were encountered: