Home / File/ reply.test-d.ts — fastify Source File

reply.test-d.ts — fastify Source File

Architecture documentation for reply.test-d.ts, a typescript file in the fastify codebase. 8 imports, 0 dependents.

File typescript CoreKernel LifecycleManager 8 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585["reply.test-d.ts"]
  2bf9986b_b7fb_0c78_f075_72fbe6f4672b["fastify.js"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> 2bf9986b_b7fb_0c78_f075_72fbe6f4672b
  531c9fc1_aab6_113a_24da_d449700fa629["./instance"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> 531c9fc1_aab6_113a_24da_d449700fa629
  ee998eba_0ed8_8b67_66d6_d2f80d980a41["./logger"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> ee998eba_0ed8_8b67_66d6_d2f80d980a41
  da3dc06e_ef04_319a_fff5_e5211e80e482["./reply"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> da3dc06e_ef04_319a_fff5_e5211e80e482
  6a6fa08e_3d60_0520_25ea_dea35398fc8f["./route"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> 6a6fa08e_3d60_0520_25ea_dea35398fc8f
  36d8862b_caf4_88a2_ba4d_4f7ed0738291["./utils"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> 36d8862b_caf4_88a2_ba4d_4f7ed0738291
  d3593968_9619_ceab_faa9_45d4da061133["node:buffer"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> d3593968_9619_ceab_faa9_45d4da061133
  1741b237_9033_f1d9_f91f_94ad04e621d4["tsd"]
  965f7b74_b8c6_ebf7_4bfd_8c4166a34585 --> 1741b237_9033_f1d9_f91f_94ad04e621d4
  style 965f7b74_b8c6_ebf7_4bfd_8c4166a34585 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Buffer } from 'node:buffer'
import { expectAssignable, expectError, expectType } from 'tsd'
import fastify, { FastifyContextConfig, FastifyReply, FastifyRequest, FastifySchema, FastifyTypeProviderDefault, RawRequestDefaultExpression, RouteHandler, RouteHandlerMethod } from '../../fastify'
import { FastifyInstance } from '../../types/instance'
import { FastifyBaseLogger } from '../../types/logger'
import { ResolveReplyTypeWithRouteGeneric } from '../../types/reply'
import { FastifyRouteConfig, RouteGenericInterface } from '../../types/route'
import { ContextConfigDefault, RawReplyDefaultExpression, RawServerDefault } from '../../types/utils'

type DefaultSerializationFunction = (payload: { [key: string]: unknown }) => string
type DefaultFastifyReplyWithCode<Code extends number> = FastifyReply<RouteGenericInterface, RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, ContextConfigDefault, FastifySchema, FastifyTypeProviderDefault, ResolveReplyTypeWithRouteGeneric<RouteGenericInterface['Reply'], Code, FastifySchema, FastifyTypeProviderDefault>>

const getHandler: RouteHandlerMethod = function (_request, reply) {
  expectType<RawReplyDefaultExpression>(reply.raw)
  expectType<FastifyBaseLogger>(reply.log)
  expectType<FastifyRequest<RouteGenericInterface, RawServerDefault, RawRequestDefaultExpression>>(reply.request)
  expectType<<Code extends number>(statusCode: Code) => DefaultFastifyReplyWithCode<Code>>(reply.code)
  expectType<<Code extends number>(statusCode: Code) => DefaultFastifyReplyWithCode<Code>>(reply.status)
  expectType<(...args: [payload?: unknown]) => FastifyReply>(reply.code(100 as number).send)
  expectType<number>(reply.elapsedTime)
  expectType<number>(reply.statusCode)
  expectType<boolean>(reply.sent)
  expectType<
          (hints: Record<string, string | string[]>, callback?: (() => void) | undefined) => void
            >(reply.writeEarlyHints)
  expectType<((...args: [payload?: unknown]) => FastifyReply)>(reply.send)
  expectAssignable<(key: string, value: any) => FastifyReply>(reply.header)
  expectAssignable<(values: { [key: string]: any }) => FastifyReply>(reply.headers)
  expectAssignable<(key: string) => number | string | string[] | undefined>(reply.getHeader)
  expectAssignable<() => { [key: string]: number | string | string[] | undefined }>(reply.getHeaders)
  expectAssignable<(key: string) => FastifyReply>(reply.removeHeader)
  expectAssignable<(key: string) => boolean>(reply.hasHeader)
  expectType<(url: string, statusCode?: number) => FastifyReply>(reply.redirect)
  expectType<() => FastifyReply>(reply.hijack)
  expectType<() => void>(reply.callNotFound)
  expectType<(contentType: string) => FastifyReply>(reply.type)
  expectType<(fn: (payload: any) => string) => FastifyReply>(reply.serializer)
  expectType<(payload: any) => string | ArrayBuffer | Buffer>(reply.serialize)
  expectType<(fulfilled: () => void, rejected: (err: Error) => void) => void>(reply.then)
  expectType<
      (
      key: string,
      fn: ((reply: FastifyReply, payload: string | Buffer | null) => Promise<string>) |
        ((reply: FastifyReply, payload: string | Buffer | null,
          done: (err: Error | null, value?: string) => void) => void)
      ) => FastifyReply
        >(reply.trailer)
  expectType<(key: string) => boolean>(reply.hasTrailer)
  expectType<(key: string) => FastifyReply>(reply.removeTrailer)
  expectType<FastifyInstance>(reply.server)
  expectAssignable<
          ((httpStatus: string) => DefaultSerializationFunction | undefined)
            >(reply.getSerializationFunction)
  expectAssignable<
          ((schema: { [key: string]: unknown }) => DefaultSerializationFunction | undefined)
            >(reply.getSerializationFunction)
  expectAssignable<
          ((schema: { [key: string]: unknown }, httpStatus?: string) => DefaultSerializationFunction)
            >(reply.compileSerializationSchema)
  expectAssignable<
// ... (195 more lines)

Domain

Subdomains

Dependencies

  • ./instance
  • ./logger
  • ./reply
  • ./route
  • ./utils
  • fastify.js
  • node:buffer
  • tsd

Frequently Asked Questions

What does reply.test-d.ts do?
reply.test-d.ts is a source file in the fastify codebase, written in typescript. It belongs to the CoreKernel domain, LifecycleManager subdomain.
What functions are defined in reply.test-d.ts?
reply.test-d.ts defines 4 function(s): getHandler, httpHeaderHandler, payload, typedHandler.
What does reply.test-d.ts depend on?
reply.test-d.ts imports 8 module(s): ./instance, ./logger, ./reply, ./route, ./utils, fastify.js, node:buffer, tsd.
Where is reply.test-d.ts in the architecture?
reply.test-d.ts is located at test/types/reply.test-d.ts (domain: CoreKernel, subdomain: LifecycleManager, directory: test/types).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free