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

Fix incorrect typings #147

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

uPaymeiFixit
Copy link

The README shows an addCard example that uses a pattern not currently valid with the CreditCardType.patterns type.

[number[]] should be number[][]

This accurately represents credit-card-type's pattern functionality and allows the README example to work:

creditCardType.addCard({
  niceType: "Visa with Custom Nice Type",
  type: creditCardType.types.VISA,
  patterns: [41111, [44, 47]],
  gaps: [4, 8, 12],
  lengths: [13, 16, 19], // add support for old, deprecated 13 digit visas
  code: {
    name: "CVV",
    size: 3,
  },
});

The [README](https://github.com/braintree/credit-card-type#adding-card-types) shows an `addCard` example  that uses a pattern not currently valid with the `CreditCardType.patterns` type. 

`[number[]]` should be `number[][]`

This accurately represents credit-card-type's pattern functionality and allows the README example to work:

```typescript
creditCardType.addCard({
  niceType: "Visa with Custom Nice Type",
  type: creditCardType.types.VISA,
  patterns: [41111, [44, 47]],
  gaps: [4, 8, 12],
  lengths: [13, 16, 19], // add support for old, deprecated 13 digit visas
  code: {
    name: "CVV",
    size: 3,
  },
});
```
@uPaymeiFixit uPaymeiFixit requested a review from a team as a code owner July 22, 2022 02:00
@hollabaq86
Copy link

👋 @uPaymeiFixit thanks for the PR! We'll take a look and provide feedback or merge, unfortunately I can't provide an ETA. For internal reference, ticket 1890

@uPaymeiFixit
Copy link
Author

In case it helps, this is the code I'm currently using as a workaround. When this type definition is fixed the as any should be able to be removed. Please reach out if I can provide any more context.

    CardValidator.creditCardType.addCard({
      niceType: 'Deprecated 13 Digit Visa',
      type: 'visa-deprecated',
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      patterns: [41111, [44, 47]] as any, // Required until this gets merged: https://github.com/braintree/credit-card-type/pull/147
      gaps: [4, 8, 12],
      lengths: [13, 16, 19], // add support for old, deprecated 13 digit visas
      code: {
        name: 'CVV',
        size: 3,
      },
    });

@uPaymeiFixit
Copy link
Author

Any updates on this?

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

Successfully merging this pull request may close these issues.

2 participants