question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken typings for StripeAuBankAccountElement when using StripeElement

See original GitHub issue

Summary

The (I assume new-ish) type StripeAuBankAccountElement seems to break compatibility for resolving other elements such as StripeCardElement against the parent StripeElement.

https://github.com/stripe/stripe-js/blob/master/types/stripe-js/elements.d.ts#L14 (strangely imported here) https://github.com/stripe/stripe-js/blob/master/types/stripe-js/elements.d.ts#L251-L263

TS2322: 
Type 'StripeElement' is not assignable to type 'StripeCardElement | StripeCardNumberElement | { token: string; }'.   

Type 'StripeAuBankAccountElement' is not assignable to type 'StripeCardElement | StripeCardNumberElement | { token: string; }'.

Type 'StripeAuBankAccountElement' is not assignable to type 'StripeCardNumberElement'.

Type 'StripeAuBankAccountElement' is not assignable to type '{ on(eventType: "change", handler: (event: StripeCardNumberElementChangeEvent) => any): StripeCardNumberElement; on(eventType: "ready", handler: (event: { ...; }) => any): StripeCardNumberElement; on(eventType: "focus", handler: (event: { ...; }) => any): StripeCardNumberElement; on(eventType: "blur", handler: (even...'.         
  Types of property 'on' are incompatible.           

Type '{ (eventType: "change", handler: (event: StripeAuBankAccountElementChangeEvent) => any): StripeAuBankAccountElement; (eventType: "ready", handler: (event: { ...; }) => any): StripeAuBankAccountElement; (eventType: "focus", handler: (event: { ...; }) => any): StripeAuBankAccountElement; (eventType: "blur", handler: (...' is not assignable to type '{ (eventType: "change", handler: (event: StripeCardNumberElementChangeEvent) => any): StripeCardNumberElement; (eventType: "ready", handler: (event: { ...; }) => any): StripeCardNumberElement; (eventType: "focus", handler: (event: { ...; }) => any): StripeCardNumberElement; (eventType: "blur", handler: (event: { ......'.             
  Types of parameters 'handler' and 'handler' are incompatible.               
  Types of parameters 'event' and 'event' are incompatible.                 
  Property 'brand' is missing in type 'StripeAuBankAccountElementChangeEvent' but required in type 'StripeCardNumberElementChangeEvent'.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
prescience-datacommented, Sep 18, 2021

What a coincidence!! I have opened an issue on react-stripe-js yesterday. @christopher-stripe This is one of the examples causing the error https://github.com/stripe/react-stripe-js/blob/master/examples/hooks/2-Split-Card.js . I have tried the example on npm homepage and sandbox as well. Same goes for them

Basically this, I can post some code when I get back to the project but this essentially covers it.

1reaction
vivekvardhanadepucommented, Sep 18, 2021

What a coincidence!! I have opened an issue on react-stripe-js yesterday. @christopher-stripe This is one of the examples causing the error https://github.com/stripe/react-stripe-js/blob/master/examples/hooks/2-Split-Card.js . I have tried the example on npm homepage and sandbox as well. Same goes for them

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scalelite session can't start by moodle: We could not find a meeting ...
Scalelite session can't start by moodle: We could not find a meeting with that meeting ID - scalelite. Hi I have Scalelite docker...
Read more >
Filter resets column sorting - TanStack/React-Table - IssueHint
Broken typings for StripeAuBankAccountElement when using StripeElement, 16, 2021-09-17, 2022-11-06. Linux Kernel Panic for 80 INT Registers, 1, 2019-10-02 ...
Read more >
stripe-js - githubmemory
Use discriminated unions to easier make distinction between types. yonatanhakatan ... Broken typings for StripeAuBankAccountElement when using StripeElement.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found