From 8965e9780b1252133db8ee6ed8ce593370447e18 Mon Sep 17 00:00:00 2001 From: Matthew Bull Date: Wed, 6 Dec 2017 21:21:17 +0000 Subject: [PATCH] Added types for koa-sslify --- types/koa-sslify/index.d.ts | 25 +++++++++++++++++ types/koa-sslify/koa-sslify-tests.ts | 40 ++++++++++++++++++++++++++++ types/koa-sslify/tsconfig.json | 23 ++++++++++++++++ types/koa-sslify/tslint.json | 1 + 4 files changed, 89 insertions(+) create mode 100644 types/koa-sslify/index.d.ts create mode 100644 types/koa-sslify/koa-sslify-tests.ts create mode 100644 types/koa-sslify/tsconfig.json create mode 100644 types/koa-sslify/tslint.json diff --git a/types/koa-sslify/index.d.ts b/types/koa-sslify/index.d.ts new file mode 100644 index 0000000000..aafd5efe13 --- /dev/null +++ b/types/koa-sslify/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for koa-sslify 2.1 +// Project: https://github.com/turboMaCk/koa-sslify#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as koa from 'koa'; + +declare namespace sslify { + interface Options { + trustProtoHeader?: boolean; + trustAzureHeader?: boolean; + port?: number; + hostname?: string; + ignoreUrl?: boolean; + temporary?: boolean; + redirectMethods?: string[]; + internalRedirectMethods?: string[]; + specCompliantDisallow?: boolean; + } +} + +declare function sslify(options: sslify.Options): koa.Middleware; + +export = sslify; diff --git a/types/koa-sslify/koa-sslify-tests.ts b/types/koa-sslify/koa-sslify-tests.ts new file mode 100644 index 0000000000..c8dae23bb4 --- /dev/null +++ b/types/koa-sslify/koa-sslify-tests.ts @@ -0,0 +1,40 @@ +import Koa = require('koa'); +import sslify = require('koa-sslify'); + +new Koa().use(sslify({})); + +new Koa().use(sslify({ + trustAzureHeader: true, +})); + +new Koa().use(sslify({ + trustProtoHeader: true, +})); + +new Koa().use(sslify({ + specCompliantDisallow: true, +})); + +new Koa().use(sslify({ + port: 1234, +})); + +new Koa().use(sslify({ + hostname: 'my-host', +})); + +new Koa().use(sslify({ + temporary: false, +})); + +new Koa().use(sslify({ + internalRedirectMethods: ['GET'], +})); + +new Koa().use(sslify({ + redirectMethods: ['GET'], +})); + +new Koa().use(sslify({ + ignoreUrl: true, +})); diff --git a/types/koa-sslify/tsconfig.json b/types/koa-sslify/tsconfig.json new file mode 100644 index 0000000000..64615e2ab9 --- /dev/null +++ b/types/koa-sslify/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-sslify-tests.ts" + ] +} diff --git a/types/koa-sslify/tslint.json b/types/koa-sslify/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/koa-sslify/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }