From e62e3a8e64ffa533bce1087292855e5fcc519680 Mon Sep 17 00:00:00 2001 From: Wayne Carson Date: Sun, 16 Dec 2018 11:58:54 -0800 Subject: [PATCH] Added typings for original (https://github.com/unshiftio/original) --- types/original/index.d.ts | 27 +++++++++++++++++++++++++++ types/original/original-tests.ts | 7 +++++++ types/original/tsconfig.json | 23 +++++++++++++++++++++++ types/original/tslint.json | 6 ++++++ 4 files changed, 63 insertions(+) create mode 100644 types/original/index.d.ts create mode 100644 types/original/original-tests.ts create mode 100644 types/original/tsconfig.json create mode 100644 types/original/tslint.json diff --git a/types/original/index.d.ts b/types/original/index.d.ts new file mode 100644 index 0000000000..04a00bd2f1 --- /dev/null +++ b/types/original/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for debounce 1.0 +// Project: https://github.com/unshiftio/original +// Definitions by: Wayne Carson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Transform an URL to a valid origin value. + * + * @param url URL to transform to it's origin. + * @returns The origin. + * @api public + */ +declare function origin(url: string|Object): string; + +declare namespace origin { + /** + * Check if the origins are the same. + * + * @param a URL or origin of a. + * @param b URL or origin of b. + * @returns true if origins are the same, false otherwise + * @api public + */ + function same(a: string, b: string): boolean; +} + +export = origin; diff --git a/types/original/original-tests.ts b/types/original/original-tests.ts new file mode 100644 index 0000000000..a7d0a865be --- /dev/null +++ b/types/original/original-tests.ts @@ -0,0 +1,7 @@ +import origin = require('original'); + +// $ExpectType string +origin('https://google.com/gmail'); + +// $ExpectType boolean +origin.same('https://google.com/gmail', 'https://google.com:443/gmail'); diff --git a/types/original/tsconfig.json b/types/original/tsconfig.json new file mode 100644 index 0000000000..e80b892467 --- /dev/null +++ b/types/original/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "original-tests.ts" + ] +} diff --git a/types/original/tslint.json b/types/original/tslint.json new file mode 100644 index 0000000000..5bc412fb1e --- /dev/null +++ b/types/original/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +}