From baafa81401f48879b199f96c7404a8470d020a28 Mon Sep 17 00:00:00 2001 From: odin3 Date: Thu, 8 Jun 2017 20:11:18 +0300 Subject: [PATCH 1/3] Add types for normalize-url --- types/normalize-url/index.d.ts | 20 ++++++++++++++++++++ types/normalize-url/tsconfig.json | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 types/normalize-url/index.d.ts create mode 100644 types/normalize-url/tsconfig.json diff --git a/types/normalize-url/index.d.ts b/types/normalize-url/index.d.ts new file mode 100644 index 00000000000000..7433263923875f --- /dev/null +++ b/types/normalize-url/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for normalize-url v1.9.1 +// Project: https://github.com/sindresorhus/normalize-url +// Definitions by: odin3 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module NormalizeUrl { + interface INormalizeUrlArgs { + normalizeProtocol: boolean; + normalizeHttps: boolean; + stripFragment: boolean; + stripWWW: boolean; + removeQueryParameters: string[]; + removeTrailingSlash: boolean; + removeDirectoryIndex: RegExp[]; + } + + function normalizeUrl(url: string, args?: INormalizeUrlArgs): string; +} + +export = NormalizeUrl.normalizeUrl; diff --git a/types/normalize-url/tsconfig.json b/types/normalize-url/tsconfig.json new file mode 100644 index 00000000000000..27e01ecd7b7705 --- /dev/null +++ b/types/normalize-url/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file From 73546dc95f1d772382cbffb1f9bdc3c8c3a4d08d Mon Sep 17 00:00:00 2001 From: odin3 Date: Thu, 8 Jun 2017 20:21:28 +0300 Subject: [PATCH 2/3] Fix code style --- types/normalize-url/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/normalize-url/index.d.ts b/types/normalize-url/index.d.ts index 7433263923875f..84cca245a55cb4 100644 --- a/types/normalize-url/index.d.ts +++ b/types/normalize-url/index.d.ts @@ -13,7 +13,7 @@ declare module NormalizeUrl { removeTrailingSlash: boolean; removeDirectoryIndex: RegExp[]; } - + function normalizeUrl(url: string, args?: INormalizeUrlArgs): string; } From df4bb363e25a8f6c239feb47a32517ead9ee9b31 Mon Sep 17 00:00:00 2001 From: Denys Sedchenko Date: Fri, 9 Jun 2017 12:57:22 +0300 Subject: [PATCH 3/3] Add tslint.json and add style fixes --- types/normalize-url/index.d.ts | 23 ++++++++++++----------- types/normalize-url/tslint.json | 7 +++++++ 2 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 types/normalize-url/tslint.json diff --git a/types/normalize-url/index.d.ts b/types/normalize-url/index.d.ts index 84cca245a55cb4..94cf9ee522a32b 100644 --- a/types/normalize-url/index.d.ts +++ b/types/normalize-url/index.d.ts @@ -1,20 +1,21 @@ -// Type definitions for normalize-url v1.9.1 +// Type definitions for normalize-url 1.9 // Project: https://github.com/sindresorhus/normalize-url // Definitions by: odin3 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module NormalizeUrl { - interface INormalizeUrlArgs { - normalizeProtocol: boolean; - normalizeHttps: boolean; - stripFragment: boolean; - stripWWW: boolean; - removeQueryParameters: string[]; - removeTrailingSlash: boolean; - removeDirectoryIndex: RegExp[]; +declare namespace NormalizeUrl { + interface NormalizeUrlArgs { + normalizeProtocol?: boolean; + normalizeHttps?: boolean; + stripFragment?: boolean; + stripWWW?: boolean; + removeQueryParameters?: string[]; + removeTrailingSlash?: boolean; + removeDirectoryIndex?: RegExp[]; } - function normalizeUrl(url: string, args?: INormalizeUrlArgs): string; + // tslint:disable-next-line align + function normalizeUrl(url: string, args?: NormalizeUrlArgs): string; } export = NormalizeUrl.normalizeUrl; diff --git a/types/normalize-url/tslint.json b/types/normalize-url/tslint.json new file mode 100644 index 00000000000000..279473e3566814 --- /dev/null +++ b/types/normalize-url/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type, and it will take effort to fix. + "ban-types": false + } +}