type-provider.test-d.ts — fastify Source File
Architecture documentation for type-provider.test-d.ts, a typescript file in the fastify codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ef34a0e1_9914_a601_dd6e_13c7d2150b71["type-provider.test-d.ts"] 2bf9986b_b7fb_0c78_f075_72fbe6f4672b["fastify.js"] ef34a0e1_9914_a601_dd6e_13c7d2150b71 --> 2bf9986b_b7fb_0c78_f075_72fbe6f4672b 1741b237_9033_f1d9_f91f_94ad04e621d4["tsd"] ef34a0e1_9914_a601_dd6e_13c7d2150b71 --> 1741b237_9033_f1d9_f91f_94ad04e621d4 bd94e3ff_2705_51a0_bac0_884f2c38b615["node:http"] ef34a0e1_9914_a601_dd6e_13c7d2150b71 --> bd94e3ff_2705_51a0_bac0_884f2c38b615 8f64b37f_2a07_4762_a249_dd47e8e1fef1["typebox"] ef34a0e1_9914_a601_dd6e_13c7d2150b71 --> 8f64b37f_2a07_4762_a249_dd47e8e1fef1 afeb22f8_a267_0a80_5a5e_a2231eae47f5["json-schema-to-ts"] ef34a0e1_9914_a601_dd6e_13c7d2150b71 --> afeb22f8_a267_0a80_5a5e_a2231eae47f5 style ef34a0e1_9914_a601_dd6e_13c7d2150b71 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fastify, {
FastifyTypeProvider,
HookHandlerDoneFunction,
FastifyRequest,
FastifyReply,
FastifyInstance,
FastifyError,
SafePromiseLike
} from '../../fastify'
import { expectAssignable, expectError, expectType } from 'tsd'
import { IncomingHttpHeaders } from 'node:http'
import { Type, TSchema, Static } from '@sinclair/typebox'
import { FromSchema, JSONSchema } from 'json-schema-to-ts'
const server = fastify()
// -------------------------------------------------------------------
// Default (unknown)
// -------------------------------------------------------------------
expectAssignable(server.get('/', (req) => expectType<unknown>(req.body)))
// -------------------------------------------------------------------
// Remapping
// -------------------------------------------------------------------
interface NumberProvider extends FastifyTypeProvider {
validator: number
serializer: number
} // remap all schemas to numbers
expectAssignable(server.withTypeProvider<NumberProvider>().get(
'/',
{
schema: {
body: { type: 'string' },
querystring: { type: 'string' },
headers: { type: 'string' },
params: { type: 'string' }
}
},
(req) => {
expectType<number & IncomingHttpHeaders>(req.headers)
expectType<number>(req.body)
expectType<number>(req.query)
expectType<number>(req.params)
}
))
// -------------------------------------------------------------------
// Override
// -------------------------------------------------------------------
interface OverriddenProvider extends FastifyTypeProvider { validator: 'inferenced' }
expectAssignable(server.withTypeProvider<OverriddenProvider>().get<{ Body: 'override' }>(
'/',
{
schema: {
body: Type.Object({
// ... (1154 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- fastify.js
- json-schema-to-ts
- node:http
- tsd
- typebox
Source
Frequently Asked Questions
What does type-provider.test-d.ts do?
type-provider.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 type-provider.test-d.ts?
type-provider.test-d.ts defines 2 function(s): auxiliaryHandler, plugin.
What does type-provider.test-d.ts depend on?
type-provider.test-d.ts imports 5 module(s): fastify.js, json-schema-to-ts, node:http, tsd, typebox.
Where is type-provider.test-d.ts in the architecture?
type-provider.test-d.ts is located at test/types/type-provider.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