elysia 2.0.0-beta.30 → 2.0.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/base.d.ts CHANGED
@@ -5,7 +5,7 @@ import { Context, ErrorContext, LifecycleContext } from "./context.js";
5
5
  import { TraceCapability, TraceHandler } from "./trace.js";
6
6
  import { AnySchema } from "./type/types.js";
7
7
  import { AotFingerprint, CompilerSession, ProgramId } from "./compile/aot.js";
8
- import { AddRoute, AddWSRoute, AfterHandler, AfterResponseHandler, AnyErrorConstructor, AnyLocalHook, BodyHandler, CompiledHandler, CreateEden, DefaultEphemeral, DefaultMetadata, DefaultSingleton, DefinitionBase, ElysiaConfig, ElysiaHandlerToResponseSchemaAmbiguous, EphemeralType, ErrorDefinitionEntry, ErrorHandler, EventScope, ExcludeElysiaResponse, ExtractErrorFromHandle, GlobalHookReturn, GracefulHandler, GuardHookSingleton, GuardLocalHook, HTTPMethod, HistoryEntry, HookContextSchema, HookContextSingleton, InlineHandler, InlineHandlerNonMacro, InputSchema, InputSchemaKey, InternalRoute, IntersectIfObjectSchema, JoinPath, LegacyScope, LocalHook, LocalHookReturn, Macro, MacroOptionContext, MacroToContext, MacroToProperty, MapResponse, MaybeArray, MaybePromise, MergeElysiaInstances, MergeSchema, MergeScopedSchemas, MetadataBase, ObjectMacroDefs, OptionalHandler, ParentResponse, PluginHookReturn, PreHandler, Prettify, PublicRoute, ResolveUsedRouteErrors, RouteBase, ScopedHookReturn, ScopedMapDeriveReturn, SingletonBase, StaticMapAliases, TransformHandler, UnionResponseStatus, UnwrapRoute, WrapFn } from "./types.js";
8
+ import { AddRoute, AddWSRoute, AfterHandler, AfterResponseHandler, AnyErrorConstructor, AnyLocalHook, BodyHandler, CatchAllEntries, CatchAllHookReturn, CompiledHandler, CreateEden, DefaultEphemeral, DefaultMetadata, DefaultSingleton, DefinitionBase, DeriveResponse, ElysiaConfig, ElysiaHandlerToResponseSchemaAmbiguous, EphemeralType, ErrorDefinitionEntry, ErrorHandler, ErrorHookStatus, EventScope, ExcludeElysiaResponse, GlobalHookReturn, GracefulHandler, GuardHookSingleton, GuardLocalHook, HTTPMethod, HistoryEntry, HookContextSchema, HookContextSingleton, InlineHandler, InlineHandlerNonMacro, InputSchema, InputSchemaKey, InternalRoute, IntersectIfObjectSchema, JoinPath, LegacyScope, LocalHook, LocalHookReturn, Macro, MacroCatchAll, MacroOptionContext, MacroToContext, MacroToProperty, MapResponse, MaybeArray, MaybePromise, MergeElysiaInstances, MergeSchema, MergeScopedSchemas, MetadataBase, ObjectMacroDefs, OptionalHandler, ParentResponse, PluginHookReturn, PreHandler, Prettify, PublicRoute, ResolveUsedRouteErrors, RouteBase, ScopedHookReturn, ScopedMapDeriveReturn, SingletonBase, StaticMapAliases, TransformHandler, UnionResponseStatus, UnwrapRoute, WithErrorEntries, WithoutMacroCatch, WrapFn } from "./types.js";
9
9
  import { RouteErrorHooks } from "./handler/utils.js";
10
10
  import { WSCapability, WSHandlerResponse, WSLocalHook, WSMessageHandler, WSOptions, WSOptionsEntry } from "./ws/types.js";
11
11
  import { RouteTable } from "./route-table.js";
@@ -15,6 +15,29 @@ import { TRef, TSchema } from "typebox";
15
15
 
16
16
  //#region src/base.d.ts
17
17
  type AnyElysia = Elysia<any, any, any, any, any, any, any, any>;
18
+ /**
19
+ * Merge two `Metadata` whose hooks all apply. `&` would intersect what both
20
+ * sides respond with at a status, and their `~error`, which must union.
21
+ * Same as in `types.ts`, kept off its public module
22
+ */
23
+ type MergeMetadata<A extends MetadataBase, B extends MetadataBase> = {} extends A['response'] ? A & B : {} extends B['response'] ? A & B : Omit<A & B, 'response'> & {
24
+ response: UnionResponseStatus<A['response'], B['response']>;
25
+ };
26
+ type IgnoresApp<Factory> = Factory extends ((...a: infer A) => any) ? A extends [] ? true : false : false;
27
+ type NotTheParent = {
28
+ '~notTheParent': true;
29
+ };
30
+ type RouteHookCapture = {
31
+ beforeHandle?: unknown;
32
+ afterHandle?: unknown;
33
+ error?: unknown;
34
+ };
35
+ type WSHookCapture = {
36
+ beforeHandle?: unknown;
37
+ error?: unknown;
38
+ };
39
+ type HookObjectKey = keyof InputSchema | 'detail' | 'parse' | 'transform' | 'derive' | 'beforeHandle' | 'afterHandle' | 'mapResponse' | 'afterResponse' | 'error' | 'trace' | 'tags';
40
+ type UnknownHookKey<Key extends PropertyKey> = [Key] extends [never] ? unknown : { [K in NoInfer<Key>]: never };
18
41
  type HocOrigin = number | {
19
42
  origin?: number;
20
43
  } | undefined;
@@ -243,46 +266,46 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
243
266
  as: As;
244
267
  }, fn: MaybeArray<TransformHandler<MergeSchema<{}, {}, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>>): this;
245
268
  onTransform<const HookScope extends EventScope>(scope: HookScope, fn: MaybeArray<TransformHandler<MergeSchema<{}, {}, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>>): this;
246
- onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
247
- onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(scope: 'local', fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
248
- onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>>>(scope: 'plugin', fn: Handler): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
249
- onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>>>(scope: 'global', fn: Handler): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
269
+ onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler, true>>;
270
+ onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(scope: 'local', fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler, true>>;
271
+ onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>>>(scope: 'plugin', fn: Handler): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler, true>>;
272
+ onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>>>(scope: 'global', fn: Handler): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler, true>>;
250
273
  /** @deprecated 1.x syntax, use `.onBeforeHandle('plugin', fn)`, `'scoped'` is now `'plugin'` */
251
274
  onBeforeHandle<const As extends 'local' | 'scoped' | 'global', const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>>>(options: {
252
275
  as: As;
253
- }, fn: Handler): ScopedHookReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
254
- onBeforeHandle<const HookScope extends EventScope, const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>>>(scope: HookScope, fn: Handler): ScopedHookReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
255
- derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
256
- derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: 'local', transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
257
- derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: 'plugin', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>) => MaybePromise<Derivative>): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
258
- derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: 'global', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>) => MaybePromise<Derivative>): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
276
+ }, fn: Handler): ScopedHookReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler, true>>;
277
+ onBeforeHandle<const HookScope extends EventScope, const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>>>(scope: HookScope, fn: Handler): ScopedHookReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler, true>>;
278
+ derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
279
+ derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'local', transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
280
+ derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'plugin', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>) => MaybePromise<Derivative>): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
281
+ derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'global', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>) => MaybePromise<Derivative>): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
259
282
  /** @deprecated 1.x syntax, use `.derive('plugin', fn)`, `'scoped'` is now `'plugin'` */
260
- derive<const As extends 'local' | 'scoped' | 'global', const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(options: {
283
+ derive<const As extends 'local' | 'scoped' | 'global', const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(options: {
261
284
  as: As;
262
- }, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>) => MaybePromise<Derivative>): ScopedHookReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
263
- derive<const HookScope extends EventScope, const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: HookScope, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>) => MaybePromise<Derivative>): ScopedHookReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
264
- mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, {
285
+ }, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>) => MaybePromise<Derivative>): ScopedHookReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
286
+ derive<const HookScope extends EventScope, const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: HookScope, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>) => MaybePromise<Derivative>): ScopedHookReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
287
+ mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, {
265
288
  derive: ExcludeElysiaResponse<Derivative>;
266
289
  schema: Volatile['schema'];
267
290
  schemas: Volatile['schemas'];
268
- response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<Derivative>>;
291
+ response: UnionResponseStatus<Volatile['response'], DeriveResponse<Derivative>>;
269
292
  error: Volatile['error'];
270
293
  }>;
271
- mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: 'local', transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, {
294
+ mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'local', transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, {
272
295
  derive: ExcludeElysiaResponse<Derivative>;
273
296
  schema: Volatile['schema'];
274
297
  schemas: Volatile['schemas'];
275
- response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<Derivative>>;
298
+ response: UnionResponseStatus<Volatile['response'], DeriveResponse<Derivative>>;
276
299
  error: Volatile['error'];
277
300
  }>;
278
- mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: 'plugin', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes, {
301
+ mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'plugin', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes, {
279
302
  derive: ExcludeElysiaResponse<Derivative>;
280
303
  schema: Ephemeral['schema'];
281
304
  schemas: Ephemeral['schemas'];
282
- response: UnionResponseStatus<Ephemeral['response'], ExtractErrorFromHandle<Derivative>>;
305
+ response: UnionResponseStatus<Ephemeral['response'], DeriveResponse<Derivative>>;
283
306
  error: Ephemeral['error'];
284
307
  }, Volatile>;
285
- mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: 'global', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, {
308
+ mapDerive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'global', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>) => MaybePromise<Derivative>): Elysia<BasePath, Scope, {
286
309
  decorator: Singleton['decorator'];
287
310
  store: Singleton['store'];
288
311
  derive: ExcludeElysiaResponse<Derivative>;
@@ -292,13 +315,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
292
315
  macro: Metadata['macro'];
293
316
  macroFn: Metadata['macroFn'];
294
317
  parser: Metadata['parser'];
295
- response: UnionResponseStatus<Metadata['response'], ExtractErrorFromHandle<Derivative>>;
318
+ response: UnionResponseStatus<Metadata['response'], DeriveResponse<Derivative>>;
296
319
  }, Routes, Ephemeral, Volatile>;
297
320
  /** @deprecated 1.x syntax, use `.mapDerive('plugin', fn)`, `'scoped'` is now `'plugin'` */
298
- mapDerive<const As extends 'local' | 'scoped' | 'global', const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(options: {
321
+ mapDerive<const As extends 'local' | 'scoped' | 'global', const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(options: {
299
322
  as: As;
300
- }, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>) => MaybePromise<Derivative>): ScopedMapDeriveReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
301
- mapDerive<const HookScope extends EventScope, const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | void>(scope: HookScope, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>) => MaybePromise<Derivative>): ScopedMapDeriveReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ExtractErrorFromHandle<Derivative>, ExcludeElysiaResponse<Derivative>>;
323
+ }, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>) => MaybePromise<Derivative>): ScopedMapDeriveReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
324
+ mapDerive<const HookScope extends EventScope, const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: HookScope, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>) => MaybePromise<Derivative>): ScopedMapDeriveReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
302
325
  onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
303
326
  onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(scope: 'local', fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
304
327
  onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>>>(scope: 'plugin', fn: Handler): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
@@ -320,7 +343,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
320
343
  as: As;
321
344
  }, fn: AfterResponseHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>): this;
322
345
  onAfterResponse<const HookScope extends EventScope>(scope: HookScope, fn: AfterResponseHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>): this;
323
- onError<const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton>>>(fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
346
+ onError<const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton>>>(fn: Handler): CatchAllHookReturn<'local', BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Handler>;
324
347
  onError<const E extends AnyErrorConstructor & (abstract new (...args: any) => Error), const Fn extends (context: ErrorContext<{}, Singleton & {
325
348
  derive: Scope extends 'local' ? Partial<Ephemeral['derive'] & Volatile['derive']> : Scope extends 'plugin' ? Ephemeral['derive'] & Partial<Volatile['derive']> : Ephemeral['derive'] & Volatile['derive'];
326
349
  }> & {
@@ -350,22 +373,22 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
350
373
  }>;
351
374
  onError<const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton & {
352
375
  derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
353
- }>>>(scope: 'local', fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
376
+ }>>>(scope: 'local', fn: Handler): CatchAllHookReturn<'local', BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Handler>;
354
377
  onError<const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton & {
355
378
  derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
356
- }>>>(scope: 'plugin', fn: Handler): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
379
+ }>>>(scope: 'plugin', fn: Handler): CatchAllHookReturn<'plugin', BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Handler>;
357
380
  onError<const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton & {
358
381
  derive: Ephemeral['derive'] & Volatile['derive'];
359
- }>>>(scope: 'global', fn: Handler): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
382
+ }>>>(scope: 'global', fn: Handler): CatchAllHookReturn<'global', BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Handler>;
360
383
  /** @deprecated 1.x syntax, use `.onError('plugin', fn)`, `'scoped'` is now `'plugin'` */
361
384
  onError<const As extends 'local' | 'scoped' | 'global', const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton & {
362
385
  derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
363
386
  }>>>(options: {
364
387
  as: As;
365
- }, fn: Handler): ScopedHookReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
388
+ }, fn: Handler): CatchAllHookReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Handler>;
366
389
  onError<const HookScope extends EventScope, const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton & {
367
390
  derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
368
- }>>>(scope: HookScope, fn: Handler): ScopedHookReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
391
+ }>>>(scope: HookScope, fn: Handler): CatchAllHookReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Handler>;
369
392
  onError<const S extends EventScope, const E extends AnyErrorConstructor & (abstract new (...args: any) => Error), const Fn extends (context: ErrorContext<{}, {
370
393
  store: Singleton['store'];
371
394
  decorator: Singleton['decorator'];
@@ -452,8 +475,8 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
452
475
  derive: Volatile['derive'] & MacroContext['derive'];
453
476
  schema: Volatile['schema'];
454
477
  schemas: Volatile['schemas'] & UnwrapRoute<Input, Definitions['typebox']> & MacroContext;
455
- response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
456
- error: Volatile['error'];
478
+ response: UnionResponseStatus<UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
479
+ error: [...Volatile['error'], ...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>];
457
480
  }>;
458
481
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>>(hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'override'> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
459
482
  derive: {};
@@ -461,8 +484,8 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
461
484
  derive: Volatile['derive'] & MacroContext['derive'];
462
485
  schema: {} extends Pick<Input, Extract<keyof Input, InputSchemaKey>> ? Volatile['schema'] : MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, Volatile['schema']>;
463
486
  schemas: Volatile['schemas'] & MacroContext;
464
- response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
465
- error: Volatile['error'];
487
+ response: UnionResponseStatus<UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
488
+ error: [...Volatile['error'], ...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>];
466
489
  }>;
467
490
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const NewElysia extends AnyElysia>(hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'merge'> & {
468
491
  schema: 'merge';
@@ -472,13 +495,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
472
495
  decorator: Singleton['decorator'];
473
496
  store: Singleton['store'];
474
497
  derive: Singleton['derive'] & MacroContext['derive'];
475
- }, Definitions, {
498
+ }, WithErrorEntries<Definitions, [...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>]>, {
476
499
  schema: Metadata['schema'];
477
500
  schemas: Metadata['schemas'] & UnwrapRoute<Input, Definitions['typebox']> & MacroContext;
478
501
  macro: Metadata['macro'];
479
502
  macroFn: Metadata['macroFn'];
480
503
  parser: Metadata['parser'];
481
- response: Metadata['response'] & MacroContext['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle>;
504
+ response: UnionResponseStatus<UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
482
505
  }, {}, Ephemeral, Volatile>) => NewElysia): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes & NewElysia['~Routes'], Ephemeral, Volatile>;
483
506
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const NewElysia extends AnyElysia>(hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'override'> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
484
507
  derive: {};
@@ -486,13 +509,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
486
509
  decorator: Singleton['decorator'];
487
510
  store: Singleton['store'];
488
511
  derive: Singleton['derive'] & MacroContext['derive'];
489
- }, Definitions, {
512
+ }, WithErrorEntries<Definitions, [...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>]>, {
490
513
  schema: MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>;
491
514
  schemas: Metadata['schemas'] & MacroContext;
492
515
  macro: Metadata['macro'];
493
516
  macroFn: Metadata['macroFn'];
494
517
  parser: Metadata['parser'];
495
- response: Metadata['response'] & MacroContext['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle>;
518
+ response: UnionResponseStatus<UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
496
519
  }, {}, {
497
520
  derive: Ephemeral['derive'];
498
521
  schema: {};
@@ -514,8 +537,8 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
514
537
  derive: Volatile['derive'] & MacroContext['derive'];
515
538
  schema: Volatile['schema'];
516
539
  schemas: Volatile['schemas'] & UnwrapRoute<Input, Definitions['typebox']> & MacroContext;
517
- response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
518
- error: Volatile['error'];
540
+ response: UnionResponseStatus<UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
541
+ error: [...Volatile['error'], ...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>];
519
542
  }>;
520
543
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>>(scope: 'local', hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'override'> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
521
544
  derive: {};
@@ -523,8 +546,8 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
523
546
  derive: Volatile['derive'] & MacroContext['derive'];
524
547
  schema: {} extends Pick<Input, Extract<keyof Input, InputSchemaKey>> ? Volatile['schema'] : MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, Volatile['schema']>;
525
548
  schemas: Volatile['schemas'] & MacroContext;
526
- response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
527
- error: Volatile['error'];
549
+ response: UnionResponseStatus<UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
550
+ error: [...Volatile['error'], ...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>];
528
551
  }>;
529
552
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>>(scope: 'plugin', hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'merge'> & {
530
553
  schema: 'merge';
@@ -534,8 +557,8 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
534
557
  derive: Ephemeral['derive'] & MacroContext['derive'];
535
558
  schema: Ephemeral['schema'];
536
559
  schemas: Ephemeral['schemas'] & UnwrapRoute<Input, Definitions['typebox']> & MacroContext;
537
- response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
538
- error: Ephemeral['error'];
560
+ response: UnionResponseStatus<UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
561
+ error: [...Ephemeral['error'], ...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>];
539
562
  }, Volatile>;
540
563
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>>(scope: 'plugin', hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'override'> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
541
564
  derive: {};
@@ -543,8 +566,8 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
543
566
  derive: Ephemeral['derive'] & MacroContext['derive'];
544
567
  schema: {} extends Pick<Input, Extract<keyof Input, InputSchemaKey>> ? Ephemeral['schema'] : MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, Ephemeral['schema']>;
545
568
  schemas: Ephemeral['schemas'] & MacroContext;
546
- response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
547
- error: Ephemeral['error'];
569
+ response: UnionResponseStatus<UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
570
+ error: [...Ephemeral['error'], ...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>];
548
571
  }, Volatile>;
549
572
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>>(scope: 'global', hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'merge'> & {
550
573
  schema: 'merge';
@@ -554,13 +577,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
554
577
  decorator: Singleton['decorator'];
555
578
  store: Singleton['store'];
556
579
  derive: Singleton['derive'] & MacroContext['derive'];
557
- }, Definitions, {
580
+ }, WithErrorEntries<Definitions, [...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>]>, {
558
581
  schema: Metadata['schema'];
559
582
  schemas: Metadata['schemas'] & UnwrapRoute<Input, Definitions['typebox']> & MacroContext;
560
583
  macro: Metadata['macro'];
561
584
  macroFn: Metadata['macroFn'];
562
585
  parser: Metadata['parser'];
563
- response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
586
+ response: UnionResponseStatus<UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
564
587
  }, Routes, Ephemeral, Volatile>;
565
588
  guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>>(scope: 'global', hook: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'override'> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
566
589
  derive: {};
@@ -568,13 +591,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
568
591
  decorator: Singleton['decorator'];
569
592
  store: Singleton['store'];
570
593
  derive: Singleton['derive'] & MacroContext['derive'];
571
- }, Definitions, {
594
+ }, WithErrorEntries<Definitions, [...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>]>, {
572
595
  schema: {} extends Pick<Input, Extract<keyof Input, InputSchemaKey>> ? Metadata['schema'] : MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, Metadata['schema']>;
573
596
  schemas: Metadata['schemas'] & MacroContext;
574
597
  macro: Metadata['macro'];
575
598
  macroFn: Metadata['macroFn'];
576
599
  parser: Metadata['parser'];
577
- response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return']>;
600
+ response: UnionResponseStatus<UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
578
601
  }, Routes, Ephemeral, Volatile>;
579
602
  group<const Prefix extends string, const NewElysia extends AnyElysia>(prefix: Prefix, run: (group: Elysia<Prefix extends '' ? BasePath : JoinPath<BasePath, Prefix>, Scope, Singleton, Definitions, {
580
603
  schema: MergeSchema<UnwrapRoute<{}, Definitions['typebox']>, Metadata['schema']>;
@@ -592,13 +615,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
592
615
  decorator: Singleton['decorator'];
593
616
  store: Singleton['store'];
594
617
  derive: Singleton['derive'] & MacroContext['derive'];
595
- }, Definitions, {
618
+ }, WithErrorEntries<Definitions, [...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>]>, {
596
619
  schema: Metadata['schema'];
597
620
  schemas: Metadata['schemas'] & UnwrapRoute<Input, Definitions['typebox']> & MacroContext;
598
621
  macro: Metadata['macro'];
599
622
  macroFn: Metadata['macroFn'];
600
623
  parser: Metadata['parser'];
601
- response: Metadata['response'] & MacroContext['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle>;
624
+ response: UnionResponseStatus<UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
602
625
  }, {}, Ephemeral, Volatile>) => NewElysia): Elysia<BasePath, Scope, Singleton, Definitions, Metadata, Routes & NewElysia['~Routes'], Ephemeral, Volatile>;
603
626
  group<const Prefix extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Prefix>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['schemas'] & Ephemeral['schemas'] & Volatile['schemas'], const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const BeforeHandle extends MaybeArray<OptionalHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>>>, const NewElysia extends AnyElysia>(prefix: Prefix, schema: GuardLocalHook<Input, Schema & MacroContext, GuardHookSingleton<Singleton, Ephemeral, Volatile, MacroContext>, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, 'override'> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
604
627
  derive: {};
@@ -606,13 +629,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
606
629
  decorator: Singleton['decorator'];
607
630
  store: Singleton['store'];
608
631
  derive: Singleton['derive'] & MacroContext['derive'];
609
- }, Definitions, {
632
+ }, WithErrorEntries<Definitions, [...CatchAllEntries<ErrorHandle>, ...MacroCatchAll<MacroContext['return' & keyof MacroContext]>]>, {
610
633
  schema: MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>;
611
634
  schemas: Metadata['schemas'] & MacroContext;
612
635
  macro: Metadata['macro'];
613
636
  macroFn: Metadata['macroFn'];
614
637
  parser: Metadata['parser'];
615
- response: Metadata['response'] & MacroContext['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle>;
638
+ response: UnionResponseStatus<UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle, true>>, UnionResponseStatus<ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle>, UnionResponseStatus<ErrorHookStatus<ErrorHandle>, WithoutMacroCatch<MacroContext['return' & keyof MacroContext]> & {}>>>;
616
639
  }, {}, {
617
640
  derive: Ephemeral['derive'];
618
641
  schema: {};
@@ -672,57 +695,87 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
672
695
  }, {
673
696
  typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
674
697
  error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
675
- }, Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes & CreateEden<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
698
+ }, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes & CreateEden<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
676
699
  derive: Volatile['derive'] & NewElysia['~Ephemeral']['derive'];
677
700
  schema: Volatile['schema'] & NewElysia['~Ephemeral']['schema'];
678
701
  schemas: Volatile['schemas'] & NewElysia['~Ephemeral']['schemas'];
679
- response: Volatile['response'] & NewElysia['~Ephemeral']['response'];
702
+ response: UnionResponseStatus<Volatile['response'], NewElysia['~Ephemeral']['response']>;
680
703
  error: [...Volatile['error'], ...NewElysia['~Ephemeral']['error']];
681
704
  }>;
682
705
  /**
683
- * Merge multiple plugin instances
706
+ * Merge multiple plugin instances, or a factory returning them
707
+ *
708
+ * A factory taking no `app` has its array inferred by the instance
709
+ * overload above, as an array rather than a tuple, so its plugins are
710
+ * lost: return it `as const`
684
711
  */
685
- use<const Instances extends AnyElysia[]>(instances: Instances): MergeElysiaInstances<Instances, BasePath, Scope, Singleton, Definitions, Metadata, Ephemeral, Volatile, Routes>;
712
+ use<const Instances extends AnyElysia[], const Param extends AnyElysia = this>(instances: Instances | ((app: Param) => readonly [...Instances])): MergeElysiaInstances<Instances, BasePath, Scope, Singleton, Definitions, Metadata, Ephemeral, Volatile, Routes>;
686
713
  /**
687
714
  * Inline functional plugin
715
+ *
716
+ * A factory that ignores `app` is assumed to return a new instance, used
717
+ * as a plugin the same way as `.use(instance)`. One returning the parent
718
+ * it captured is mistyped, types can't see instance identity. A factory
719
+ * declaring a parameter, even an optional one, is typed as returning `app`
688
720
  */
689
- use<const NewElysia extends AnyElysia, const Param extends AnyElysia = this>(plugin: (app: Param) => NewElysia): Elysia<BasePath, Scope, {
721
+ use<const NewElysia extends AnyElysia, const Param extends AnyElysia = this, const Factory = unknown>(plugin: Factory & ((app: Param) => NewElysia)): IgnoresApp<Factory> extends true ? Elysia<BasePath, Scope, {
690
722
  decorator: Singleton['decorator'] & NewElysia['~Singleton']['decorator'];
691
723
  store: Prettify<Singleton['store'] & NewElysia['~Singleton']['store']>;
692
724
  derive: Singleton['derive'] & NewElysia['~Singleton']['derive'];
693
725
  }, {
694
726
  typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
695
727
  error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
696
- }, Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, {
728
+ }, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes & CreateEden<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
729
+ derive: Volatile['derive'] & NewElysia['~Ephemeral']['derive'];
730
+ schema: Volatile['schema'] & NewElysia['~Ephemeral']['schema'];
731
+ schemas: Volatile['schemas'] & NewElysia['~Ephemeral']['schemas'];
732
+ response: UnionResponseStatus<Volatile['response'], NewElysia['~Ephemeral']['response']>;
733
+ error: [...Volatile['error'], ...NewElysia['~Ephemeral']['error']];
734
+ }> : Elysia<BasePath, Scope, {
735
+ decorator: Singleton['decorator'] & NewElysia['~Singleton']['decorator'];
736
+ store: Prettify<Singleton['store'] & NewElysia['~Singleton']['store']>;
737
+ derive: Singleton['derive'] & NewElysia['~Singleton']['derive'];
738
+ }, {
739
+ typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
740
+ error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
741
+ }, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, {
697
742
  derive: Ephemeral['derive'] & NewElysia['~Ephemeral']['derive'];
698
743
  schema: Ephemeral['schema'] & NewElysia['~Ephemeral']['schema'];
699
744
  schemas: Ephemeral['schemas'] & NewElysia['~Ephemeral']['schemas'];
700
- response: Ephemeral['response'] & NewElysia['~Ephemeral']['response'];
745
+ response: UnionResponseStatus<Ephemeral['response'], NewElysia['~Ephemeral']['response']>;
701
746
  error: NewElysia['~Ephemeral']['error'];
702
747
  }, {
703
748
  derive: Volatile['derive'] & NewElysia['~Volatile']['derive'];
704
749
  schema: Volatile['schema'] & NewElysia['~Volatile']['schema'];
705
750
  schemas: Volatile['schemas'] & NewElysia['~Volatile']['schemas'];
706
- response: Volatile['response'] & NewElysia['~Volatile']['response'];
751
+ response: UnionResponseStatus<Volatile['response'], NewElysia['~Volatile']['response']>;
707
752
  error: NewElysia['~Volatile']['error'];
708
753
  }>;
709
754
  /**
710
755
  * async plugin instance
756
+ *
757
+ * A factory that ignores `app` is assumed to resolve to a new instance,
758
+ * used as a plugin the same way. One resolving to the parent it captured
759
+ * is mistyped, types can't see instance identity. A factory declaring a
760
+ * parameter, even an optional one, is typed as returning `app`, see the
761
+ * async functional plugin below
711
762
  */
712
763
  use<const NewElysia extends AnyElysia>(instance: Promise<NewElysia | {
713
764
  default: NewElysia;
714
- }>): Elysia<BasePath, Scope, {
765
+ }> | ((app?: NotTheParent) => MaybePromise<NewElysia | {
766
+ default: NewElysia;
767
+ }>)): Elysia<BasePath, Scope, {
715
768
  decorator: Singleton['decorator'] & NewElysia['~Singleton']['decorator'];
716
769
  store: Prettify<Singleton['store'] & NewElysia['~Singleton']['store']>;
717
770
  derive: Singleton['derive'] & Partial<NewElysia['~Singleton']['derive']>;
718
771
  }, {
719
772
  typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
720
773
  error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
721
- }, Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes & CreateEden<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
774
+ }, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes & CreateEden<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
722
775
  derive: Volatile['derive'] & Partial<NewElysia['~Ephemeral']['derive']>;
723
776
  schema: Volatile['schema'] & NewElysia['~Ephemeral']['schema'];
724
777
  schemas: Volatile['schemas'] & NewElysia['~Ephemeral']['schemas'];
725
- response: Volatile['response'] & NewElysia['~Ephemeral']['response'];
778
+ response: UnionResponseStatus<Volatile['response'], NewElysia['~Ephemeral']['response']>;
726
779
  error: [...Volatile['error'], ...NewElysia['~Ephemeral']['error']];
727
780
  }>;
728
781
  /**
@@ -737,17 +790,17 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
737
790
  }, {
738
791
  typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
739
792
  error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
740
- }, Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, {
793
+ }, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, {
741
794
  derive: Ephemeral['derive'] & Partial<NewElysia['~Ephemeral']['derive']>;
742
795
  schema: Ephemeral['schema'] & NewElysia['~Ephemeral']['schema'];
743
796
  schemas: Ephemeral['schemas'] & NewElysia['~Ephemeral']['schemas'];
744
- response: Ephemeral['response'] & NewElysia['~Ephemeral']['response'];
797
+ response: UnionResponseStatus<Ephemeral['response'], NewElysia['~Ephemeral']['response']>;
745
798
  error: NewElysia['~Ephemeral']['error'];
746
799
  }, {
747
800
  derive: Volatile['derive'] & Partial<NewElysia['~Volatile']['derive']>;
748
801
  schema: Volatile['schema'] & NewElysia['~Volatile']['schema'];
749
802
  schemas: Volatile['schemas'] & NewElysia['~Volatile']['schemas'];
750
- response: Volatile['response'] & NewElysia['~Volatile']['response'];
803
+ response: UnionResponseStatus<Volatile['response'], NewElysia['~Volatile']['response']>;
751
804
  error: NewElysia['~Volatile']['error'];
752
805
  }>;
753
806
  /**
@@ -790,9 +843,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
790
843
  * .get('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
791
844
  * ```
792
845
  */
793
- get<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
846
+ get<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
794
847
  derive: Ephemeral['derive'] & Volatile['derive'];
795
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'get', Path, Schema, MacroContext, Handle>;
848
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'get', Path, Schema, MacroContext, Handle, Input>;
796
849
  get<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
797
850
  derive: Ephemeral['derive'] & Volatile['derive'];
798
851
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'get', Path, Schema, {}, Handle>;
@@ -810,9 +863,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
810
863
  * .post('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
811
864
  * ```
812
865
  */
813
- post<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
866
+ post<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
814
867
  derive: Ephemeral['derive'] & Volatile['derive'];
815
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'post', Path, Schema, MacroContext, Handle>;
868
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'post', Path, Schema, MacroContext, Handle, Input>;
816
869
  post<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
817
870
  derive: Ephemeral['derive'] & Volatile['derive'];
818
871
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'post', Path, Schema, {}, Handle>;
@@ -830,9 +883,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
830
883
  * .put('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
831
884
  * ```
832
885
  */
833
- put<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
886
+ put<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
834
887
  derive: Ephemeral['derive'] & Volatile['derive'];
835
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'put', Path, Schema, MacroContext, Handle>;
888
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'put', Path, Schema, MacroContext, Handle, Input>;
836
889
  put<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
837
890
  derive: Ephemeral['derive'] & Volatile['derive'];
838
891
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'put', Path, Schema, {}, Handle>;
@@ -850,9 +903,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
850
903
  * .patch('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
851
904
  * ```
852
905
  */
853
- patch<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
906
+ patch<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
854
907
  derive: Ephemeral['derive'] & Volatile['derive'];
855
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'patch', Path, Schema, MacroContext, Handle>;
908
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'patch', Path, Schema, MacroContext, Handle, Input>;
856
909
  patch<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
857
910
  derive: Ephemeral['derive'] & Volatile['derive'];
858
911
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'patch', Path, Schema, {}, Handle>;
@@ -870,9 +923,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
870
923
  * .delete('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
871
924
  * ```
872
925
  */
873
- delete<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
926
+ delete<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
874
927
  derive: Ephemeral['derive'] & Volatile['derive'];
875
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'delete', Path, Schema, MacroContext, Handle>;
928
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'delete', Path, Schema, MacroContext, Handle, Input>;
876
929
  delete<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
877
930
  derive: Ephemeral['derive'] & Volatile['derive'];
878
931
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'delete', Path, Schema, {}, Handle>;
@@ -890,9 +943,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
890
943
  * .options('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
891
944
  * ```
892
945
  */
893
- options<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
946
+ options<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
894
947
  derive: Ephemeral['derive'] & Volatile['derive'];
895
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'options', Path, Schema, MacroContext, Handle>;
948
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'options', Path, Schema, MacroContext, Handle, Input>;
896
949
  options<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
897
950
  derive: Ephemeral['derive'] & Volatile['derive'];
898
951
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'options', Path, Schema, {}, Handle>;
@@ -910,9 +963,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
910
963
  * .query('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
911
964
  * ```
912
965
  */
913
- query<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
966
+ query<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
914
967
  derive: Ephemeral['derive'] & Volatile['derive'];
915
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'query', Path, Schema, MacroContext, Handle>;
968
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'query', Path, Schema, MacroContext, Handle, Input>;
916
969
  query<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
917
970
  derive: Ephemeral['derive'] & Volatile['derive'];
918
971
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'query', Path, Schema, {}, Handle>;
@@ -930,9 +983,9 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
930
983
  * .head('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
931
984
  * ```
932
985
  */
933
- head<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
986
+ head<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
934
987
  derive: Ephemeral['derive'] & Volatile['derive'];
935
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'head', Path, Schema, MacroContext, Handle>;
988
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'head', Path, Schema, MacroContext, Handle, Input>;
936
989
  head<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
937
990
  derive: Ephemeral['derive'] & Volatile['derive'];
938
991
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'head', Path, Schema, {}, Handle>;
@@ -949,15 +1002,15 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
949
1002
  * .method('Elysia', '/', 'hi')
950
1003
  * ```
951
1004
  */
952
- method<const Method extends HTTPMethod, const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
1005
+ method<const Method extends HTTPMethod, const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
953
1006
  derive: Ephemeral['derive'] & Volatile['derive'];
954
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(method: Method, path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Method, Path, Schema, MacroContext, Handle>;
1007
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(method: Method, path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Method, Path, Schema, MacroContext, Handle, Input>;
955
1008
  method<const Method extends HTTPMethod, const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
956
1009
  derive: Ephemeral['derive'] & Volatile['derive'];
957
1010
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(method: Method, path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Method, Path, Schema, {}, Handle>;
958
1011
  all<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
959
1012
  derive: Ephemeral['derive'] & Volatile['derive'];
960
- }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator>, fn: Handle): this;
1013
+ }, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey>, fn: Handle): this;
961
1014
  all<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
962
1015
  derive: Ephemeral['derive'] & Volatile['derive'];
963
1016
  }, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): this;
@@ -966,21 +1019,21 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
966
1019
  * Register a WebSocket route as `(path, options)`, `(path, handler)`, or `(path, options, handler)`.
967
1020
  * Requires `.use(websocket())` from `elysia/websocket`.
968
1021
  */
969
- ws<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>)>(path: Path, options: WSLocalHook<Input, Schema & MacroContext, Singleton & {
1022
+ ws<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & WSHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>)>(path: Path, options: WSLocalHook<Input, Schema & MacroContext, Singleton & {
970
1023
  derive: Ephemeral['derive'] & Volatile['derive'] & MacroContext['derive'];
971
1024
  }> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
972
1025
  derive: {};
973
- }>>): AddWSRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Path, Schema, MacroContext, void>;
1026
+ }>>): AddWSRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Path, Schema, MacroContext, void, Input['error'], Input['beforeHandle']>;
974
1027
  ws<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handler extends WSMessageHandler<Schema & MacroContext, Singleton & {
975
1028
  derive: Ephemeral['derive'] & Volatile['derive'] & MacroContext['derive'];
976
1029
  }>>(path: Path, handler: Handler): AddWSRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Path, Schema, MacroContext, WSHandlerResponse<Handler>>;
977
- ws<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handler extends WSMessageHandler<Schema & MacroContext, Singleton & {
1030
+ ws<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & WSHookCapture, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handler extends WSMessageHandler<Schema & MacroContext, Singleton & {
978
1031
  derive: Ephemeral['derive'] & Volatile['derive'] & MacroContext['derive'];
979
1032
  }>>(path: Path, options: WSLocalHook<Input, Schema & MacroContext, Singleton & {
980
1033
  derive: Ephemeral['derive'] & Volatile['derive'] & MacroContext['derive'];
981
1034
  }> & MacroOptionContext<Metadata['macroFn'], Schema, GuardHookSingleton<Singleton, Ephemeral, Volatile, {
982
1035
  derive: {};
983
- }>>, handler: Handler): AddWSRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Path, Schema, MacroContext, WSHandlerResponse<Handler>>;
1036
+ }>>, handler: Handler): AddWSRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Path, Schema, MacroContext, WSHandlerResponse<Handler>, Input['error'], Input['beforeHandle']>;
984
1037
  mount(handle: (request: Request) => MaybePromise<Response>): this;
985
1038
  mount(path: string, handle: (request: Request) => MaybePromise<Response>): this;
986
1039
  /**