From 6d32ce4302819c2909e5e007d1fa00d46e276f22 Mon Sep 17 00:00:00 2001 From: Vincent DELACOURT Date: Fri, 31 May 2019 03:00:20 +0800 Subject: [PATCH] Add react-native-mail (#35801) --- types/react-native-mail/index.d.ts | 37 +++++++++++++++++++ .../react-native-mail-tests.ts | 6 +++ types/react-native-mail/tsconfig.json | 16 ++++++++ types/react-native-mail/tslint.json | 1 + 4 files changed, 60 insertions(+) create mode 100644 types/react-native-mail/index.d.ts create mode 100644 types/react-native-mail/react-native-mail-tests.ts create mode 100644 types/react-native-mail/tsconfig.json create mode 100644 types/react-native-mail/tslint.json diff --git a/types/react-native-mail/index.d.ts b/types/react-native-mail/index.d.ts new file mode 100644 index 0000000000..66ac0085b6 --- /dev/null +++ b/types/react-native-mail/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for react-native-mail 3.0 +// Project: https://github.com/chirag04/react-native-mail#readme +// Definitions by: DELACOURT Vincent +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export namespace Mailer { + function mail(options: { + subject: string; + body: string; + isHTML: boolean; + recipients?: [string]; + ccRecipients?: [string]; + bccRecipients?: [string]; + attachment?: { + /** + * The absolute path of the file from which to read data. + */ + path: string; + /** + * Mime Type: jpg, png, doc, ppt, html, pdf, csv + */ + type: string; + /** + * Optional: Custom filename for attachment + */ + name?: string; + }; + }, callback: ( + error: string, + /** + * On Android, the callback will only be called if an error occurs. The event argument is unused! + */ + event: string + ) => void): void; +} + +export default Mailer; diff --git a/types/react-native-mail/react-native-mail-tests.ts b/types/react-native-mail/react-native-mail-tests.ts new file mode 100644 index 0000000000..2e67c7ca36 --- /dev/null +++ b/types/react-native-mail/react-native-mail-tests.ts @@ -0,0 +1,6 @@ +import Mailer from "react-native-mail"; + +Mailer.mail( + { subject: "", body: "", isHTML: false }, + (error: string, event: string) => {} +); diff --git a/types/react-native-mail/tsconfig.json b/types/react-native-mail/tsconfig.json new file mode 100644 index 0000000000..ea53968c4d --- /dev/null +++ b/types/react-native-mail/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-native-mail-tests.ts"] +} diff --git a/types/react-native-mail/tslint.json b/types/react-native-mail/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-mail/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }