From 8d887707f542ad7bc45384d36283da0d62c41968 Mon Sep 17 00:00:00 2001 From: Gabe Lerner Date: Sun, 6 Jan 2019 22:03:10 -0600 Subject: [PATCH 1/2] Make credit card issuer optional for other types This will fix my local for now but in the future, can consider making it a generic class with `TextInputMask` and `type: T` representing the type. Then propagate the generic argument and make `TextInputMaskProps` and `TextInputMaskOptionProp`. Finally, you can use https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html to select the right subset of properties. If the money properties were in a type called `TextInputMaskOptionMoneyProp` and the phone ones were in `TextInputMaskOptionPhoneProp`, then I believe you can do `type TextInputMaskOptionProp = T extends "money" ? TextInputMaskOptionMoneyProp : T extends "phone" ? TextInputMaskOptionPhoneProp : etc...`. This way, the user will see exactly the properties they need based on the original `type=` prop. --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 125a7d2e..9f049bc9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -40,7 +40,7 @@ export interface TextInputMaskOptionProp { // Credit card type. obfuscated?: boolean - issuer: 'visa-or-mastercard' | 'diners' | 'amex' + issuer?: 'visa-or-mastercard' | 'diners' | 'amex' // Custom type. mask?: string From f8dbe7ed36fcc54bfa9be7673f1ca451761c07ad Mon Sep 17 00:00:00 2001 From: Ben-hur Santos Ott Date: Mon, 7 Jan 2019 05:47:10 -0200 Subject: [PATCH 2/2] fix(ts): fixing issuer --- CHANGELOG.md | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa64d285..b5ab7a73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,19 @@ ## Unreleased +## [1.10.1] - 2019-01-07 + +### Fixed + +- Fixing `issuer` in ts file. (Thanks to [Gabe Lerner](https://github.com/gabelerner)) + ## [1.10.0] - 2019-01-06 ### Added - Credit Card Mask: adding support for `diners` and `amex`. (Thanks to [Marin Bezhanov](https://github.com/mbezhanov)) -### Fix +### Fixed - [#107](https://github.com/benhurott/react-native-masked-text/issues/107): Props missing - TypeScript map out of date. - [#115](https://github.com/benhurott/react-native-masked-text/issues/115): setNativeProps is not a function diff --git a/package.json b/package.json index 7c224a97..665ffc7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-masked-text", - "version": "1.10.0", + "version": "1.10.1", "description": "Text and TextInput with mask for React Native applications", "licenses": [ {