diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 210e1cc332..220a96868f 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -120,7 +120,7 @@ export interface PluginBase { * * server - the server object with a plugin-specific server.realm. * * options - any options passed to the plugin during registration via server.register(). */ - register: (server: Server, options: T) => Promise; + register: (server: Server, options: T) => void | Promise; /** (optional) if true, allows the plugin to be registered multiple times with the same server. Defaults to false. */ multiple?: boolean; diff --git a/types/hapi/test/server/server-plugins.ts b/types/hapi/test/server/server-plugins.ts index 7f3d194f84..8de3fdc24f 100644 --- a/types/hapi/test/server/server-plugins.ts +++ b/types/hapi/test/server/server-plugins.ts @@ -13,6 +13,10 @@ interface Plugin3 { three: 3; } +interface Plugin4 { + four: 4; +} + declare module 'hapi' { interface PluginProperties { example: { @@ -42,6 +46,11 @@ const plugin3: Plugin = { register: async (server: Server, options: Plugin3) => {} }; +const plugin4: Plugin = { + name: 'plugin4', + register: (server: Server, options: Plugin4) => {} +}; + const server = new Server({ port: 8000, }); @@ -90,5 +99,9 @@ server.register([ { plugin: plugin1, options: {one: 1} + }, + { + plugin: plugin4, + options: {four: 4} } ]);