forked from MapComplete/MapComplete
		
	Chore: better typing
This commit is contained in:
		
							parent
							
								
									96265a55c8
								
							
						
					
					
						commit
						3ae0d51082
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -1,4 +1,4 @@ | |||
| import { parsePhoneNumberFromString } from "libphonenumber-js" | ||||
| import { CountryCode, parsePhoneNumberFromString } from "libphonenumber-js" | ||||
| import { Validator } from "../Validator" | ||||
| import { Translation } from "../../i18n/Translation" | ||||
| import Translations from "../../i18n/Translations" | ||||
|  | @ -46,16 +46,16 @@ export default class PhoneValidator extends Validator { | |||
|         if (str.startsWith("tel:")) { | ||||
|             str = str.substring("tel:".length) | ||||
|         } | ||||
|         let countryCode = undefined | ||||
|         let countryCode: CountryCode = undefined | ||||
|         if (country) { | ||||
|             countryCode = country() | ||||
|             countryCode = <CountryCode> country()?.toUpperCase() | ||||
|         } | ||||
|         if (this.isShortCode(str, countryCode?.toUpperCase())) { | ||||
|         if (this.isShortCode(str, countryCode)) { | ||||
|             return str | ||||
|         } | ||||
|         return parsePhoneNumberFromString( | ||||
|             str, | ||||
|             countryCode?.toUpperCase() as any | ||||
|             countryCode | ||||
|         )?.formatInternational() | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue