Skip to content

fix(node): relax Fastify's setupFastifyErrorHandler argument type #18621

Description

@github-actions

Note

The pull request "fix(node): relax Fastify's setupFastifyErrorHandler argument type" was created by @logaretm but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.

When using exactOptionalPropertyTypes, it is pretty hard to match Fastify's instance types given all the missing overloads from the partial signature we have. The problematic area is around addHook.

We either need to have all the signatures implemented exactly, or outright import Fastify's types which is not ideal since it is not a dependency.

I opted to relax the types specifically for setupFastifyErrorHandler by providing a minimal instance with the one method it needs to avoid TS trying to matching the other properties and methods signatures, not ideal but simple enough.

I verified that this works for Fastify v3 throughout v5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions