diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 2e8641497e..3628a7a931 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: '/',