Skip to content

Does not work with TypeScript 4.8 #4221

@SimenB

Description

@SimenB

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.5.2

Plugin version

No response

Node.js version

16.17.0

Operating system

macOS

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

12.15.1

Description

The fresh TypeScript 4.8 release is not compatible with Fastify's types.

Example:

node_modules/fastify/types/route.d.ts:48:98 - error TS2344: Type 'SchemaCompiler' does not satisfy the constraint 'FastifySchema'.

48   onRequest?: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, Logger> | onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig,
SchemaCompiler, TypeProvider, Logger>[];
                                                                                                    ~~~~~~~~~~~~~~

  node_modules/fastify/types/route.d.ts:27:3
    27   SchemaCompiler = FastifySchema,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends FastifySchema` constraint.

/cc @fastify/typescript

Steps to Reproduce

See https://github.com/SimenB/fastify-ts

Expected Behavior

No type error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions