Browse Source

Updates the type annotations in phonenumberutil.js (#2443)

* Updates the type annotations in phonenumberutil.js

Updates the type annotations to indicate the inputs are required to be non-null.

* Update pending_code_changes.txt

* Update pending_code_changes.txt
pull/3882/head
Doug Roeper 6 years ago
committed by GitHub
parent
commit
01ff83569b
2 changed files with 13 additions and 12 deletions
  1. +11
    -11
      javascript/i18n/phonenumbers/phonenumberutil.js
  2. +2
    -1
      pending_code_changes.txt

+ 11
- 11
javascript/i18n/phonenumbers/phonenumberutil.js View File

@ -2904,7 +2904,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.getNumberTypeHelper_ =
* code is invalid or unknown. * code is invalid or unknown.
* *
* @param {?string} regionCode * @param {?string} regionCode
* @return {i18n.phonenumbers.PhoneMetadata}
* @return {?i18n.phonenumbers.PhoneMetadata}
*/ */
i18n.phonenumbers.PhoneNumberUtil.prototype.getMetadataForRegion = i18n.phonenumbers.PhoneNumberUtil.prototype.getMetadataForRegion =
function(regionCode) { function(regionCode) {
@ -2935,7 +2935,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.getMetadataForRegion =
/** /**
* @param {number} countryCallingCode * @param {number} countryCallingCode
* @return {i18n.phonenumbers.PhoneMetadata}
* @return {?i18n.phonenumbers.PhoneMetadata}
*/ */
i18n.phonenumbers.PhoneNumberUtil.prototype. i18n.phonenumbers.PhoneNumberUtil.prototype.
getMetadataForNonGeographicalRegion = function(countryCallingCode) { getMetadataForNonGeographicalRegion = function(countryCallingCode) {
@ -2978,7 +2978,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.isNumberMatchingDesc_ =
* number "789272696". This is valid, while the original string is not * number "789272696". This is valid, while the original string is not
* diallable. * diallable.
* *
* @param {i18n.phonenumbers.PhoneNumber} number the phone number that we want
* @param {!i18n.phonenumbers.PhoneNumber} number the phone number that we want
* to validate. * to validate.
* @return {boolean} a boolean that indicates whether the number is of a valid * @return {boolean} a boolean that indicates whether the number is of a valid
* pattern. * pattern.
@ -3003,7 +3003,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.isValidNumber = function(number) {
* as the Isle of Man as invalid for the region "GB" (United Kingdom), since it * as the Isle of Man as invalid for the region "GB" (United Kingdom), since it
* has its own region code, "IM", which may be undesirable. * has its own region code, "IM", which may be undesirable.
* *
* @param {i18n.phonenumbers.PhoneNumber} number the phone number that we want
* @param {!i18n.phonenumbers.PhoneNumber} number the phone number that we want
* to validate. * to validate.
* @param {?string} regionCode the region that we want to validate the phone * @param {?string} regionCode the region that we want to validate the phone
* number for. * number for.
@ -3039,7 +3039,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.isValidNumberForRegion =
* geocoding at the region level. Only guarantees correct results for valid, * geocoding at the region level. Only guarantees correct results for valid,
* full numbers (not short-codes, or invalid numbers). * full numbers (not short-codes, or invalid numbers).
* *
* @param {i18n.phonenumbers.PhoneNumber} number the phone number whose origin
* @param {?i18n.phonenumbers.PhoneNumber} number the phone number whose origin
* we want to know. * we want to know.
* @return {?string} the region where the phone number is from, or null * @return {?string} the region where the phone number is from, or null
* if no region matches this calling code. * if no region matches this calling code.
@ -3067,7 +3067,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.getRegionCodeForNumber =
/** /**
* @param {i18n.phonenumbers.PhoneNumber} number
* @param {!i18n.phonenumbers.PhoneNumber} number
* @param {Array.<string>} regionCodes * @param {Array.<string>} regionCodes
* @return {?string} * @return {?string}
* @private * @private
@ -3128,7 +3128,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.getRegionCodeForCountryCode =
* returned. * returned.
* *
* @param {number} countryCallingCode the country calling code. * @param {number} countryCallingCode the country calling code.
* @return {Array.<string>}
* @return {!Array.<string>}
*/ */
i18n.phonenumbers.PhoneNumberUtil.prototype.getRegionCodesForCountryCode = i18n.phonenumbers.PhoneNumberUtil.prototype.getRegionCodesForCountryCode =
function(countryCallingCode) { function(countryCallingCode) {
@ -3552,7 +3552,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.isPossibleNumberString =
* valid, and resets the PhoneNumber object passed in to that valid version. If * valid, and resets the PhoneNumber object passed in to that valid version. If
* no valid number could be extracted, the PhoneNumber object passed in will not * no valid number could be extracted, the PhoneNumber object passed in will not
* be modified. * be modified.
* @param {i18n.phonenumbers.PhoneNumber} number a PhoneNumber object which
* @param {!i18n.phonenumbers.PhoneNumber} number a PhoneNumber object which
* contains a number that is too long to be valid. * contains a number that is too long to be valid.
* @return {boolean} true if a valid phone number can be successfully extracted. * @return {boolean} true if a valid phone number can be successfully extracted.
*/ */
@ -4016,7 +4016,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.checkRegionForParsing_ = function(
* be stored as that of the default region supplied. If the number is * be stored as that of the default region supplied. If the number is
* guaranteed to start with a '+' followed by the country calling code, then * guaranteed to start with a '+' followed by the country calling code, then
* 'ZZ' or null can be supplied. * 'ZZ' or null can be supplied.
* @return {i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
* @return {!i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
* with the parsed number. * with the parsed number.
* @throws {Error} if the string is not considered to be a * @throws {Error} if the string is not considered to be a
* viable phone number (e.g. too few or too many digits) or if no default * viable phone number (e.g. too few or too many digits) or if no default
@ -4041,7 +4041,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.parse = function(numberToParse,
* from. This is only used if the number being parsed is not written in * from. This is only used if the number being parsed is not written in
* international format. The country calling code for the number in this * international format. The country calling code for the number in this
* case would be stored as that of the default region supplied. * case would be stored as that of the default region supplied.
* @return {i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
* @return {!i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
* with the parsed number. * with the parsed number.
* @throws {Error} if the string is not considered to be a * @throws {Error} if the string is not considered to be a
* viable phone number or if no default region was supplied. * viable phone number or if no default region was supplied.
@ -4106,7 +4106,7 @@ i18n.phonenumbers.PhoneNumberUtil.setItalianLeadingZerosForPhoneNumber_ =
* phoneNumber with numberToParse. * phoneNumber with numberToParse.
* @param {boolean} checkRegion should be set to false if it is permitted for * @param {boolean} checkRegion should be set to false if it is permitted for
* the default coregion to be null or unknown ('ZZ'). * the default coregion to be null or unknown ('ZZ').
* @return {i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
* @return {!i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
* with the parsed number. * with the parsed number.
* @throws {Error} * @throws {Error}
* @private * @private


+ 2
- 1
pending_code_changes.txt View File

@ -1 +1,2 @@
Code changes:
- [JS only] Updates some closure annotations in `phonenumberutil.js` to indicate non-nullable parameters

Loading…
Cancel
Save