Skip to content

Commit 4625fa4

Browse files
Fix: Add explicit string[] type to validUSRegionCodes array
The array's element type was inferred as a narrow union of string literals from CONST.COUNTRY, causing Array.includes() to reject the generic string from parsedPhoneNumber.regionCode. Co-authored-by: Lydia Barclay <lydiabarclay@users.noreply.github.com>
1 parent 67a3152 commit 4625fa4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/libs/ValidationUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ function isValidUSPhone(phoneNumber = '', isCountryCodeOptional?: boolean): bool
324324

325325
// US territories share the +1 country calling code but have their own ISO region codes.
326326
// We accept these as valid US phone numbers for wallet/bank account verification.
327-
const validUSRegionCodes = [CONST.COUNTRY.US, CONST.COUNTRY.PR, CONST.COUNTRY.GU, CONST.COUNTRY.VI, CONST.COUNTRY.AS, CONST.COUNTRY.MP];
327+
const validUSRegionCodes: string[] = [CONST.COUNTRY.US, CONST.COUNTRY.PR, CONST.COUNTRY.GU, CONST.COUNTRY.VI, CONST.COUNTRY.AS, CONST.COUNTRY.MP];
328328
return parsedPhoneNumber.possible && validUSRegionCodes.includes(parsedPhoneNumber.regionCode ?? '');
329329
}
330330

0 commit comments

Comments
 (0)