[intl-tel-input] Add promise property.

This commit is contained in:
Leonard Thieu
2018-12-24 17:36:03 -05:00
parent 5196b80b78
commit 157cf118d8
2 changed files with 23 additions and 6 deletions
+2
View File
@@ -37,6 +37,8 @@ declare namespace IntlTelInput {
}
interface Plugin {
promise: Promise<void>;
/**
* Remove the plugin from the input, and unbind any event listeners.
*/
+21 -6
View File
@@ -1,9 +1,24 @@
import intlTelInput = require('intl-tel-input');
// $ExpectType (node: Element, options?: Options) => Plugin
intlTelInput;
function test_import() {
// $ExpectType (node: Element, options?: Options) => Plugin
intlTelInput;
}
// $ExpectError
const options: IntlTelInput.Options = {
allowDropdown: true
};
function test_IntlTelInput_not_visible() {
// $ExpectError
const options: IntlTelInput.Options = {
allowDropdown: true
};
}
function test_intlTelInputUtils_global() {
const input = document.querySelector('#phone');
const iti = intlTelInput(input, {
utilsScript: 'node_modules/intl-tel-input/build/js/utils.js'
});
iti.promise.then(() => {
console.log(intlTelInputUtils.numberFormat.E164);
});
}