Merge pull request #9792 from fdnhkj/intl-tel-input

Intl tel input - Removed wrong static functions typings
This commit is contained in:
Mohamed Hegazy
2016-06-23 20:16:45 -07:00
committed by GitHub
2 changed files with 8 additions and 22 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ let ntlNumber = $('#phone').intlTelInput('getNumber', intlTelInputUtils.numberFo
let numberType = $('#phone').intlTelInput('getNumberType');
if (numberType === intlTelInputUtils.numberType.MOBILE) {}
let countryData = $('#phone').intlTelInput('getSelectedCountryData');
let selectedCountryData = $('#phone').intlTelInput('getSelectedCountryData');
let error = $('#phone').intlTelInput('getValidationError');
if (error === intlTelInputUtils.validationError.TOO_SHORT) {}
@@ -39,9 +39,9 @@ $('#phone').intlTelInput('setCountry', 'gb');
$('#phone').intlTelInput('setNumber', '+447733123456');
let countryData3 = $.intlTelInput.getCountryData();
let countryData = $.fn.intlTelInput.getCountryData();
$.intlTelInput.loadUtils('build/js/utils.js');
$.fn.intlTelInput.loadUtils('build/js/utils.js');
$('#phone').intlTelInput({
utilsScript: '../../build/js/utils.js'
+5 -19
View File
@@ -3,6 +3,11 @@
// Definitions by: Fidan Hakaj <https://github.com/fdnhkj/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Static methods that are defined in JQueryStatic.fn are not typed
// as jquery.d.ts has no interface for fn
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts#L958
// fn: any; //TODO: Decide how we want to type this
/// <reference path="../jquery/jquery.d.ts" />
declare namespace IntlTelInput {
@@ -113,21 +118,6 @@ declare namespace IntlTelInput {
iso2: string;
dialCode: string;
}
interface Static {
/**
* Get all of the plugin's country data.
* Note that any modifications must be done before initialising the plugin.
*/
getCountryData: () => Array<CountryData>;
/**
* Note: this is only needed if you're lazy loading the plugin script itself (intlTelInput.js).
* If not then just use the utilsScript option. Load the utils.js script
* (included in the lib directory) to enable formatting/validation etc.
* @param path path to the utils.js script.
*/
loadUtils: (path: string) => void;
}
}
declare namespace intlTelInputUtils {
@@ -163,10 +153,6 @@ declare namespace intlTelInputUtils {
}
}
interface JQueryStatic {
intlTelInput: IntlTelInput.Static;
}
interface JQuery {
/**
* Remove the plugin from the input, and unbind any event listeners.