fastify / fastify/fastify-type-provider-typebox

Fastify().withTypeProvider<T> is incompatible with the latest fastify (5.6.2)

Open
#262 6 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
205
Forks
29
Avg merge
2m
Merged PRs (30d)
1

Description

### Prerequisites

- [x] I have written a descriptive issue title
- [x] I have searched existing issues to ensure the regression has not already been reported

### Last working version

5.2.0

### Stopped working in version

6.0.0

### Node.js version

24.0.2

### Operating system

macOS

### Operating system version (i.e. 20.04, 11.3, 10)

15.7.1

### 💥 Regression Report

When I follow the tutorial in the `Readme.md` and want to register the type provider, I get the following error:

Image

Here is how I register it:
```ts
import Fastify from 'fastify';
import type { TypeBoxTypeProvider } from '@fastify/type-provider-typebox';
import { TypeBoxValidatorCompiler } from '@fastify/type-provider-typebox';

const app = Fastify()
.withTypeProvider()
.setValidatorCompiler(TypeBoxValidatorCompiler);
```

Here is my tsconfig:
```json
{
"$schema": "https://json.schemastore.org/tsconfig",
// Disables automatic compilation on file save in IDEs
"compileOnSave": false,
"compilerOptions": {
// Type Checking - Strict Mode
// Enables all strict type checking options at once
"strict": true,
// Reports errors on unused local variables
"noUnusedLocals": true,
// Reports errors on unused function parameters
"noUnusedParameters": true,
// Distinguishes between `undefined` and missing properties in optional types
"exactOptionalPropertyTypes": true,
// Requires all code paths in a function to explicitly return a value
"noImplicitReturns": true,
// Reports errors for fallthrough cases in switch statements (missing breaks)
"noFallthroughCasesInSwitch": true,
// Adds `undefined` to any un-declared index signature property access
"noUncheckedIndexedAccess": true,
// Requires `override` keyword when overriding base class members
"noImplicitOverride": true,
// Forces bracket notation for index signature property access instead of dot notation
"noPropertyAccessFromIndexSignature": true,

// Language and Environment
// Sets the JavaScript language version for emitted JavaScript (latest features)
"target": "esnext",
// Specifies the library files to include in the compilation (latest JS features)
"lib": ["ESNext"],
// Treats all files as modules, even without import/export statements
"moduleDetection": "force",

// Modules
// Sets the module system (Node.js ESM and CommonJS support)
"module": "nodenext",
// Determines how module specifiers are resolved (Node.js resolution for ESM)
"moduleResolution": "nodenext",
// Allows importing TypeScript files with extensions in import statements
"allowImportingTsExtensions": true,
// Enables importing JSON files as modules
"resolveJsonModule": true,
// Reports errors for imports that may have side effects but appear unused
"noUncheckedSideEffectImports": true,

// Emit
// Disables emitting compiled JavaScript files (type-checking only)
"noEmit": true,
// Ensures each file can be transpiled independently (required for certain bundlers)
"isolatedModules": true,
// Enforces import type syntax for type-only imports (clearer intent)
"verbatimModuleSyntax": true,
// Emits additional JS to ease interoperability with CommonJS modules
"esModuleInterop": true,

// Completeness
// Ensures file names have consistent casing across different operating systems
"forceConsistentCasingInFileNames": true,
// Only allows syntax that can be erased by the TypeScript compiler (no types in runtime)
"erasableSyntaxOnly": true,
// Skips type checking of declaration files (.d.ts) for faster compilation
"skipLibCheck": true,
// Specifies which global type definitions to include (Node.js types)
"types": ["node"]
},
// Explicitly includes the reset type definitions file
"files": ["./reset.d.ts"]
}

```

### Steps to Reproduce

Use script above with fastify 5.6.2 and fastify/fastify-type-provider-typebox 6.1.0

### Expected Behavior

No ts error

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.