diff --git a/intl-tel-input/intl-tel-input-tests.ts b/intl-tel-input/intl-tel-input-tests.ts index 739fcc854b..c10acfffa0 100644 --- a/intl-tel-input/intl-tel-input-tests.ts +++ b/intl-tel-input/intl-tel-input-tests.ts @@ -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' diff --git a/intl-tel-input/intl-tel-input.d.ts b/intl-tel-input/intl-tel-input.d.ts index 7779f34bd4..c092084738 100644 --- a/intl-tel-input/intl-tel-input.d.ts +++ b/intl-tel-input/intl-tel-input.d.ts @@ -3,6 +3,11 @@ // Definitions by: Fidan Hakaj // 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 + /// 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; - /** - * 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.