Add type definitions for email-check (#47097)

This commit is contained in:
Luke Jones 2020-08-28 13:59:15 +10:00 committed by GitHub
parent 40c72bd5eb
commit 24f1e8d601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import emailCheck = require('email-check');
const checkWithoutOptions: Promise<boolean> = emailCheck('recipient@email.com');
const options: emailCheck.EmailCheckOptions = { from: 'sender@email.com', host: 'email.com', timeout: 10000 };
const checkWithOptions: Promise<boolean> = emailCheck('recipient@email.com', options);
const partialOptions: emailCheck.EmailCheckOptions = { from: 'sender@email.com' };
const checkWithPartialOptions: Promise<boolean> = emailCheck('recipient@email.com', partialOptions);

16
types/email-check/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
// Type definitions for email-check 1.1
// Project: https://github.com/pensierinmusica/email-check
// Definitions by: Luke Jones <https://github.com/luke-j>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace emailCheck {
interface EmailCheckOptions {
from?: string;
host?: string;
timeout?: number;
}
}
declare function emailCheck(email: string, options?: emailCheck.EmailCheckOptions): Promise<boolean>;
export = emailCheck;

View File

@ -0,0 +1,23 @@
{
"files": [
"index.d.ts",
"email-check-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}