From 791f043bdbb668bb3f7af61b377384179107d217 Mon Sep 17 00:00:00 2001 From: ozum Date: Fri, 16 Mar 2018 19:27:49 +0300 Subject: [PATCH] [hapi] Fix: Make server.app non-optional --- types/hapi/index.d.ts | 4 ++-- types/hapi/test/server/server-app.ts | 12 ++++++------ types/hapi/test/server/server-table.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 220a96868f..fc66eaf1d1 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -2586,7 +2586,7 @@ export interface ServerInjectOptions extends Shot.RequestOptions { /** * sets the initial value of request.app, defaults to {}. */ - app?: ApplicationState; + app: ApplicationState; /** * sets the initial value of request.plugins, defaults to {}. */ @@ -3257,7 +3257,7 @@ export class Server extends Podium { * Initialized with an empty object. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverapp) */ - app?: ApplicationState; + app: ApplicationState; /** * Server Auth: properties and methods diff --git a/types/hapi/test/server/server-app.ts b/types/hapi/test/server/server-app.ts index 8e9cff88b0..69bac86e2f 100644 --- a/types/hapi/test/server/server-app.ts +++ b/types/hapi/test/server/server-app.ts @@ -6,20 +6,20 @@ const options: ServerOptions = { }; declare module "hapi" { - // Demonstrate augmenting the application state. - interface ApplicationState { - key?: string; - } + // Demonstrate augmenting the application state. + interface ApplicationState { + key?: string; + } } const server = new Server(options); -server.app!.key = 'value2'; +server.app.key = 'value2'; const serverRoute: ServerRoute = { path: '/', method: 'GET', handler(request, h) { - return 'key: ' + request.server.app!.key; + return 'key: ' + request.server.app.key; } }; diff --git a/types/hapi/test/server/server-table.ts b/types/hapi/test/server/server-table.ts index 9237a2be28..ab14938be4 100644 --- a/types/hapi/test/server/server-table.ts +++ b/types/hapi/test/server/server-table.ts @@ -6,7 +6,7 @@ const options: ServerOptions = { }; const server = new Server(options); -server.app!.key = 'value2'; +server.app.key = 'value2'; server.route({ path: '/',