Skip to content
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

Type definitions for onBlur and onFocus are incorrect #105

Closed
madisonbullard opened this issue Jul 1, 2020 · 8 comments · Fixed by stripe/stripe-js#208
Closed

Type definitions for onBlur and onFocus are incorrect #105

madisonbullard opened this issue Jul 1, 2020 · 8 comments · Fixed by stripe/stripe-js#208

Comments

@madisonbullard
Copy link

https://github.com/stripe/react-stripe-js/blob/master/src/types/index.ts#L18
https://github.com/stripe/react-stripe-js/blob/master/src/types/index.ts#L23

The type definitions do not properly define the argument passed to onBlur and onFocus props. Both functions are called with a single argument with the following shape:
{ elementType: 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' }

I might've missed some possible options, but I know that those 4 are valid.

Can we update the types to reflect the function signature?

@hofman-stripe
Copy link
Contributor

Thanks for reporting. It looks like the event handler type is also not correctly documented in the base library (e.g. https://github.com/stripe/stripe-js/blob/master/types/stripe-js/elements/card.d.ts)

We'll look into fixing those definitions.

@stale
Copy link

stale bot commented Mar 13, 2021

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.

@stale stale bot added the stale label Mar 13, 2021
@stale stale bot closed this as completed Mar 20, 2021
@madisonbullard
Copy link
Author

The type defs are still incorrect here. Can we re-open in case someone has time to take a look? Thanks!

@bsharon-stripe
Copy link
Contributor

Thanks for flagging @madisonbullard, I agree that this should get fixed!

@christopher-stripe
Copy link
Contributor

Hi @madisonbullard, this has been fixed in 1.15.1.

@jakub-sarnowski-blinkhealth
Copy link

jakub-sarnowski-blinkhealth commented Oct 18, 2021

Wait. This is still not fixed in this library, isn't it?
https://github.com/stripe/react-stripe-js/blob/master/src/types/index.ts#L23

@jodhman
Copy link

jodhman commented Nov 30, 2022

Can confirm in late 2022 that the type definitions are still incorrect.
The onBlur passes down one argument of type StripeElementType.

@martinalong-stripe
Copy link
Contributor

Should be fixed! Fix will deploy later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants