hooks.test-d.ts — fastify Source File
Architecture documentation for hooks.test-d.ts, a typescript file in the fastify codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 24048042_c4dc_2873_c147_48de9560b8ea["hooks.test-d.ts"] 2bf9986b_b7fb_0c78_f075_72fbe6f4672b["fastify.js"] 24048042_c4dc_2873_c147_48de9560b8ea --> 2bf9986b_b7fb_0c78_f075_72fbe6f4672b ce8cd88b_1c50_7142_5167_00ce90d3f4fc["./hooks"] 24048042_c4dc_2873_c147_48de9560b8ea --> ce8cd88b_1c50_7142_5167_00ce90d3f4fc 6a6fa08e_3d60_0520_25ea_dea35398fc8f["./route"] 24048042_c4dc_2873_c147_48de9560b8ea --> 6a6fa08e_3d60_0520_25ea_dea35398fc8f 473a42a8_a580_301b_42c4_5215be78511b["error"] 24048042_c4dc_2873_c147_48de9560b8ea --> 473a42a8_a580_301b_42c4_5215be78511b 1741b237_9033_f1d9_f91f_94ad04e621d4["tsd"] 24048042_c4dc_2873_c147_48de9560b8ea --> 1741b237_9033_f1d9_f91f_94ad04e621d4 style 24048042_c4dc_2873_c147_48de9560b8ea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { FastifyError } from '@fastify/error'
import { expectAssignable, expectError, expectType } from 'tsd'
import fastify, {
ContextConfigDefault, FastifyContextConfig,
FastifyInstance,
FastifyPluginOptions,
FastifyReply,
FastifyRequest,
FastifySchema,
FastifyTypeProviderDefault,
RawReplyDefaultExpression,
RawRequestDefaultExpression,
RawServerDefault,
RegisterOptions,
RouteOptions,
// preClose hook types should be exported correctly https://github.com/fastify/fastify/pull/5335
/* eslint-disable @typescript-eslint/no-unused-vars */
preCloseAsyncHookHandler,
preCloseHookHandler
} from '../../fastify'
import { DoneFuncWithErrOrRes, HookHandlerDoneFunction, RequestPayload, preHandlerAsyncHookHandler } from '../../types/hooks'
import { FastifyRouteConfig, RouteGenericInterface } from '../../types/route'
const server = fastify()
// Test payload generic pass through for preSerialization and onSend
type TestPayloadType = {
foo: string;
bar: number;
}
// Synchronous Tests
server.addHook('onRequest', function (request, reply, done) {
expectType<FastifyInstance>(this)
expectType<FastifyRequest>(request)
expectType<FastifyReply>(reply)
expectAssignable<(err?: FastifyError) => void>(done)
expectAssignable<(err?: NodeJS.ErrnoException) => void>(done)
expectType<void>(done(new Error()))
})
server.addHook('preParsing', function (request, reply, payload, done) {
expectType<FastifyInstance>(this)
expectType<FastifyRequest>(request)
expectType<FastifyReply>(reply)
expectType<RequestPayload>(payload)
expectAssignable<(err?: FastifyError | null, res?: RequestPayload) => void>(done)
expectAssignable<(err?: NodeJS.ErrnoException) => void>(done)
expectType<void>(done(new Error()))
})
server.addHook('preValidation', function (request, reply, done) {
expectType<FastifyInstance>(this)
expectType<FastifyRequest>(request)
expectType<FastifyReply>(reply)
expectAssignable<(err?: FastifyError) => void>(done)
expectAssignable<(err?: NodeJS.ErrnoException) => void>(done)
expectType<void>(done(new Error()))
// ... (491 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- ./hooks
- ./route
- error
- fastify.js
- tsd
Source
Frequently Asked Questions
What does hooks.test-d.ts do?
hooks.test-d.ts is a source file in the fastify codebase, written in typescript. It belongs to the CoreKernel domain, InstanceFactory subdomain.
What functions are defined in hooks.test-d.ts?
hooks.test-d.ts defines 1 function(s): customTypedHook.
What does hooks.test-d.ts depend on?
hooks.test-d.ts imports 5 module(s): ./hooks, ./route, error, fastify.js, tsd.
Where is hooks.test-d.ts in the architecture?
hooks.test-d.ts is located at test/types/hooks.test-d.ts (domain: CoreKernel, subdomain: InstanceFactory, directory: test/types).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free