-
Notifications
You must be signed in to change notification settings - Fork 137
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
Typescript: Fix type for paymentMethodsConfiguration #2363
Typescript: Fix type for paymentMethodsConfiguration #2363
Conversation
🦋 Changeset detectedLatest commit: 57adaa0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Change: -21 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Summary
We were using discriminating union types for the PaymentMethodsConfiguration object.
That means that, if merchant passes config like:
The type inference for the 'card' would not work, as it will be considered as
[key: string]: UIElementProps;
according to the discriminated union type inferred by Typescript.In this PR, we make a union type instead. And in order to properly map non-mapped TxVariants, we should use the
any
keyword, otherwise all entry-values will fallback to[key: string]: UIElementProps;
typeFixed issue:
#2349
#2320