From 61155b24328a5a6b2c2c9ea2eaff27ec0e7260ab Mon Sep 17 00:00:00 2001 From: Danilo Alonso Date: Fri, 22 Aug 2025 16:56:55 -0400 Subject: [PATCH] feat: add types --- lib/index.d.ts | 37 +++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 38 insertions(+) create mode 100644 lib/index.d.ts diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 0000000..fcda7fd --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,37 @@ +declare module '@hapi/glue' { + + import { Plugin, Server, ServerOptions, ServerRegisterOptions } from '@hapi/hapi'; + + export interface GlueOptions { + relativeTo: string; + preRegister?: ((server: Server) => Promise) | undefined; + } + + export interface GluePluginObject { + plugin: ( + string | + Plugin | + { + plugin: string | Plugin, + options?: unknown, + routes?: ServerRegisterOptions['routes'] + } + ); + options?: unknown; + routes?: unknown; + } + + export interface GlueManifest { + server: ServerOptions; + register?: { + plugins: GluePluginObject[], + options?: ServerRegisterOptions + } + } + + export function compose( + manifest: GlueManifest, + options?: GlueOptions + ): Promise; + +} diff --git a/package.json b/package.json index 208888f..8042bca 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "url": "git://github.com/hapijs/glue" }, "main": "lib/index.js", + "types": "lib/types.d.ts", "files": [ "lib" ],