From 15fe2ba0e641eab6d2960522a52066ff1f67bbbd Mon Sep 17 00:00:00 2001 From: Steve Ognibene Date: Tue, 13 Dec 2016 10:45:14 -0500 Subject: [PATCH] Add typings for the inert extension to hapi.js see: https://github.com/hapijs/inert/pull/78 --- inert/index.d.ts | 15 +++++++++++++++ inert/inert-tests-es6.ts | 7 +++++++ inert/inert-tests.ts | 9 +++++++++ inert/tsconfig.json | 20 ++++++++++++++++++++ inert/tslint.json | 1 + 5 files changed, 52 insertions(+) create mode 100644 inert/index.d.ts create mode 100644 inert/inert-tests-es6.ts create mode 100644 inert/inert-tests.ts create mode 100644 inert/tsconfig.json create mode 100644 inert/tslint.json diff --git a/inert/index.d.ts b/inert/index.d.ts new file mode 100644 index 0000000000..fdd3d91bcd --- /dev/null +++ b/inert/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for inert 4.0 +// Project: https://github.com/hapijs/inert/ +// Definitions by: Steve Ognibene +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Note: this definition contains only enough to make TypeScript happy (hapi?) when +// importing inert. The functionality that importing inert adds to the reply +// object and its other features are implemented in the hapi definition on +// DefinitelyTyped. The inert object is never actually used in practice except to +// be passed as an extension to the server.register() method which already takes +// an `any` argument, so just using `any` here is fine. + +/// + +export var inert: any; \ No newline at end of file diff --git a/inert/inert-tests-es6.ts b/inert/inert-tests-es6.ts new file mode 100644 index 0000000000..ac50196d00 --- /dev/null +++ b/inert/inert-tests-es6.ts @@ -0,0 +1,7 @@ + +import * as HapiES6 from 'hapi'; +import * as InertES6 from 'inert'; + + +const server = new HapiES6.Server({}); +server.register(InertES6, () => {}); \ No newline at end of file diff --git a/inert/inert-tests.ts b/inert/inert-tests.ts new file mode 100644 index 0000000000..cd12de7780 --- /dev/null +++ b/inert/inert-tests.ts @@ -0,0 +1,9 @@ + +const Inert = require('inert'); +const Hapi = require('hapi'); + + +const server = new Hapi.Server({}); +server.register(Inert, () => {}); + +export var makeThisAModule: any; \ No newline at end of file diff --git a/inert/tsconfig.json b/inert/tsconfig.json new file mode 100644 index 0000000000..9c678b93ff --- /dev/null +++ b/inert/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "inert-tests.ts", + "inert-tests-es6.ts" + ] +} \ No newline at end of file diff --git a/inert/tslint.json b/inert/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/inert/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file