From 2e2227cddef5936ed7d742f8c78a942a3ad6dd67 Mon Sep 17 00:00:00 2001 From: Felix Hao Date: Wed, 6 Nov 2019 03:18:42 +0800 Subject: [PATCH] Add package: openurl & openurl2 (#40065) * add package: openurl & openurl2 * fix lint --- types/openurl/index.d.ts | 9 +++++++++ types/openurl/openurl-tests.ts | 8 ++++++++ types/openurl/tsconfig.json | 23 +++++++++++++++++++++++ types/openurl/tslint.json | 3 +++ types/openurl2/index.d.ts | 9 +++++++++ types/openurl2/openurl2-tests.ts | 8 ++++++++ types/openurl2/tsconfig.json | 23 +++++++++++++++++++++++ types/openurl2/tslint.json | 3 +++ 8 files changed, 86 insertions(+) create mode 100644 types/openurl/index.d.ts create mode 100644 types/openurl/openurl-tests.ts create mode 100644 types/openurl/tsconfig.json create mode 100644 types/openurl/tslint.json create mode 100644 types/openurl2/index.d.ts create mode 100644 types/openurl2/openurl2-tests.ts create mode 100644 types/openurl2/tsconfig.json create mode 100644 types/openurl2/tslint.json diff --git a/types/openurl/index.d.ts b/types/openurl/index.d.ts new file mode 100644 index 0000000000..0e8ba25438 --- /dev/null +++ b/types/openurl/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for openurl 1.0 +// Project: https://github.com/rauschma/openurl +// Definitions by: Felix Hao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export function open(url: string, callback?: (err: Error) => void): void; +export function mailto(recipients: string[], fields: {[key: string]: string}, recipientsSeparator?: string, callback?: (err: Error) => void): void; diff --git a/types/openurl/openurl-tests.ts b/types/openurl/openurl-tests.ts new file mode 100644 index 0000000000..ecfc56e72d --- /dev/null +++ b/types/openurl/openurl-tests.ts @@ -0,0 +1,8 @@ +import { open, mailto } from "openurl"; +open("http://rauschma.de", (e) => { + console.log(e.message); +}); +mailto( + ["john@example.com", "jane@example.com"], + { subject: "Hello!", body: "This is\nan automatically sent email!\n" } +); diff --git a/types/openurl/tsconfig.json b/types/openurl/tsconfig.json new file mode 100644 index 0000000000..320f63b662 --- /dev/null +++ b/types/openurl/tsconfig.json @@ -0,0 +1,23 @@ +{ + "files": [ + "index.d.ts", + "openurl-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/openurl/tslint.json b/types/openurl/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/openurl/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/openurl2/index.d.ts b/types/openurl2/index.d.ts new file mode 100644 index 0000000000..e455c3cdb6 --- /dev/null +++ b/types/openurl2/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for openurl2 1.0 +// Project: https://github.com/rauschma/openurl +// Definitions by: Felix Hao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export function open(url: string, callback?: (err: Error) => void): void; +export function mailto(recipients: string[], fields: {[key: string]: string}, recipientsSeparator?: string, callback?: (err: Error) => void): void; diff --git a/types/openurl2/openurl2-tests.ts b/types/openurl2/openurl2-tests.ts new file mode 100644 index 0000000000..dc4145e9b2 --- /dev/null +++ b/types/openurl2/openurl2-tests.ts @@ -0,0 +1,8 @@ +import { open, mailto } from "openurl2"; +open("http://rauschma.de", (e) => { + console.log(e.message); +}); +mailto( + ["john@example.com", "jane@example.com"], + { subject: "Hello!", body: "This is\nan automatically sent email!\n" } +); diff --git a/types/openurl2/tsconfig.json b/types/openurl2/tsconfig.json new file mode 100644 index 0000000000..596e3c4992 --- /dev/null +++ b/types/openurl2/tsconfig.json @@ -0,0 +1,23 @@ +{ + "files": [ + "index.d.ts", + "openurl2-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/openurl2/tslint.json b/types/openurl2/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/openurl2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}