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

register.test-d.ts — fastify Source File

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

File typescript CoreKernel LifecycleManager 4 imports 26 functions

Entity Profile

Dependency Diagram

graph LR
  dc6b1fdb_8a90_02fb_f48d_70037e6f417c["register.test-d.ts"]
  2bf9986b_b7fb_0c78_f075_72fbe6f4672b["fastify.js"]
  dc6b1fdb_8a90_02fb_f48d_70037e6f417c --> 2bf9986b_b7fb_0c78_f075_72fbe6f4672b
  1741b237_9033_f1d9_f91f_94ad04e621d4["tsd"]
  dc6b1fdb_8a90_02fb_f48d_70037e6f417c --> 1741b237_9033_f1d9_f91f_94ad04e621d4
  bd94e3ff_2705_51a0_bac0_884f2c38b615["node:http"]
  dc6b1fdb_8a90_02fb_f48d_70037e6f417c --> bd94e3ff_2705_51a0_bac0_884f2c38b615
  3e7d58ec_f92a_95db_e97c_fb49a00b5105["node:http2"]
  dc6b1fdb_8a90_02fb_f48d_70037e6f417c --> 3e7d58ec_f92a_95db_e97c_fb49a00b5105
  style dc6b1fdb_8a90_02fb_f48d_70037e6f417c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { expectAssignable, expectError, expectType } from 'tsd'
import { IncomingMessage, Server, ServerResponse } from 'node:http'
import { Http2Server, Http2ServerRequest, Http2ServerResponse } from 'node:http2'
import fastify, { FastifyInstance, FastifyError, FastifyBaseLogger, FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, RawServerDefault } from '../../fastify'

const testPluginCallback: FastifyPluginCallback = function (instance, opts, done) { }
const testPluginAsync: FastifyPluginAsync = async function (instance, opts) { }

const testPluginOpts: FastifyPluginCallback = function (instance, opts, done) { }
const testPluginOptsAsync: FastifyPluginAsync = async function (instance, opts) { }

const testPluginOptsWithType = (
  instance: FastifyInstance,
  opts: FastifyPluginOptions,
  done: (error?: FastifyError) => void
) => { }
const testPluginOptsWithTypeAsync = async (instance: FastifyInstance, opts: FastifyPluginOptions) => { }

interface TestOptions extends FastifyPluginOptions {
  option1: string;
  option2: boolean;
}

// Type validation
expectError(fastify().register(testPluginOptsAsync, { prefix: 1 }))
expectError(fastify().register(testPluginOptsAsync, { logLevel: () => ({}) }))
expectError(fastify().register(testPluginOptsAsync, { logSerializers: () => ({}) }))
expectError(fastify().register({}))

expectAssignable<FastifyInstance>(
  fastify().register(
    testPluginOptsAsync, { prefix: '/example', logLevel: 'info', logSerializers: { key: (value: any) => `${value}` } }
  )
)

expectAssignable<FastifyInstance>(
  fastify().register(testPluginOptsAsync, () => {
    return {}
  })
)

expectAssignable<FastifyInstance>(
  fastify().register(testPluginOptsAsync, (instance) => {
    expectType<FastifyInstance>(instance)
  })
)

// With Http2
const serverWithHttp2 = fastify({ http2: true })
type ServerWithHttp2 = FastifyInstance<Http2Server, Http2ServerRequest, Http2ServerResponse>
const testPluginWithHttp2: FastifyPluginCallback<TestOptions, Http2Server> = function (instance, opts, done) { }
const testPluginWithHttp2Async: FastifyPluginAsync<TestOptions, Http2Server> = async function (instance, opts) { }
const testPluginWithHttp2WithType = (
  instance: ServerWithHttp2,
  opts: FastifyPluginOptions,
  done: (error?: FastifyError) => void
) => { }
const testPluginWithHttp2WithTypeAsync = async (
  instance: ServerWithHttp2,
  opts: FastifyPluginOptions
// ... (178 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does register.test-d.ts do?
register.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 register.test-d.ts?
register.test-d.ts defines 26 function(s): customLogger.child, customLogger.debug, customLogger.error, customLogger.fatal, customLogger.info, customLogger.silent, customLogger.trace, customLogger.warn, testPluginAsync, testPluginCallback, and 16 more.
What does register.test-d.ts depend on?
register.test-d.ts imports 4 module(s): fastify.js, node:http, node:http2, tsd.
Where is register.test-d.ts in the architecture?
register.test-d.ts is located at test/types/register.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