Skip to content

Commit 1562086

Browse files
committed
update(types): add attempt to overload function
1 parent b9d8b5b commit 1562086

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

types/hooks.d.ts

-9
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ export interface onRequestHookHandler<
3333
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
3434
done: HookHandlerDoneFunction
3535
): void;
36-
}
37-
38-
export interface onRequestAsyncHookHandler<
39-
RawServer extends RawServerBase = RawServerDefault,
40-
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
41-
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
42-
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
43-
ContextConfig = ContextConfigDefault
44-
> {
4536
(
4637
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
4738
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,

types/instance.d.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FastifySchemaCompiler, FastifySchemaValidationError } from './schema'
44
import { RawServerBase, RawRequestDefaultExpression, RawServerDefault, RawReplyDefaultExpression, ContextConfigDefault } from './utils'
55
import { FastifyLoggerInstance } from './logger'
66
import { FastifyRegister } from './register'
7-
import { onRequestHookHandler, preParsingHookHandler, onSendHookHandler, preValidationHookHandler, preHandlerHookHandler, preSerializationHookHandler, onResponseHookHandler, onErrorHookHandler, onRouteHookHandler, onRegisterHookHandler, onCloseHookHandler, onReadyHookHandler, onTimeoutHookHandler, onRequestAsyncHookHandler, preParsingAsyncHookHandler, preValidationAsyncHookHandler, preHandlerAsyncHookHandler, preSerializationAsyncHookHandler, onSendAsyncHookHandler, onResponseAsyncHookHandler, onTimeoutAsyncHookHandler, onErrorAsyncHookHandler, onReadyAsyncHookHandler } from './hooks'
7+
import { onRequestHookHandler, preParsingHookHandler, onSendHookHandler, preValidationHookHandler, preHandlerHookHandler, preSerializationHookHandler, onResponseHookHandler, onErrorHookHandler, onRouteHookHandler, onRegisterHookHandler, onCloseHookHandler, onReadyHookHandler, onTimeoutHookHandler, preParsingAsyncHookHandler, preValidationAsyncHookHandler, preHandlerAsyncHookHandler, preSerializationAsyncHookHandler, onSendAsyncHookHandler, onResponseAsyncHookHandler, onTimeoutAsyncHookHandler, onErrorAsyncHookHandler, onReadyAsyncHookHandler } from './hooks'
88
import { FastifyRequest } from './request'
99
import { FastifyReply } from './reply'
1010
import { FastifyError } from 'fastify-error'
@@ -96,14 +96,6 @@ export interface FastifyInstance<
9696
hook: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
9797
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
9898

99-
addHook<
100-
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
101-
ContextConfig = ContextConfigDefault
102-
>(
103-
name: 'onRequest',
104-
hook: onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
105-
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
106-
10799
/**
108100
* `preParsing` is the second hook to be executed in the request lifecycle. The previous hook was `onRequest`, the next hook will be `preValidation`.
109101
* Notice: in the `preParsing` hook, request.body will always be null, because the body parsing happens before the `preHandler` hook.

0 commit comments

Comments
 (0)