Skip to content

fix: declare fastify as a peer dependency - #297

Closed
ezefernandezyf wants to merge 2 commits into
fastify:mainfrom
ezefernandezyf:fix/peer-dependency
Closed

ezefernandezyf wants to merge 2 commits into
fastify:mainfrom
ezefernandezyf:fix/peer-dependency

Conversation

@ezefernandezyf

Copy link
Copy Markdown

Fixes #262

Summary

The published type declarations (dist/cjs/index.d.ts) import types from fastify, but fastify was not declared in peerDependencies. In pnpm-strict (non-hoisted) setups this breaks type resolution with TS2307: Cannot find module 'fastify' plus a TS2344 cascade (TypeBoxTypeProvider does not satisfy FastifyTypeProvider).

Declare "fastify": "^5.0.0" as a flat required peer dependency, matching the repo's devDependencies range and the ecosystem convention.

Changes

File Change
package.json Add fastify: ^5.0.0 to peerDependencies
.github/workflows/ci.yml Add consumer-types job: pack the real tarball, install under pnpm strict as a workspace member, tsc --noEmit on a README-faithful consumer

Verification

Why the CI check matters

attw and tstyche cannot detect a missing peer dependency: neither exercises consumer-side peer resolution. The consumer-types job installs the published tarball exactly like a strict pnpm consumer and type-checks it, which is the only check that proves this fix. The fixture is a pnpm workspace member (a plain file: dir masks the defect via hoisting), strips devDependencies from the extracted manifest (real consumers never install a dependency's devDeps), and pins @types/node@^24 (@types/node@26 breaks thread-stream under skipLibCheck: false).

Note for maintainers (out of scope)

The automerge job gates Dependabot PRs on needs: [quality-check, test] only; adding consumer-types to that list would also gate Dependabot PRs on the new check.

@Fdawgs

Fdawgs commented Sep 23, 2026

Copy link
Copy Markdown
Member

Thanks for the PR, unfortunately this'll be a no.
See fastify/fastify-sensible#216 (comment)

@ezefernandezyf

ezefernandezyf commented Sep 23, 2026 •

Copy link
Copy Markdown
Author

Thanks for the quick review @Fdawgs, understood. I had missed the ecosystem decision in fastify/fastify#1780 and fastify-plugin#93 that plugins intentionally do not declare fastify as a peer dependency. Closing this PR. Appreciate the pointer!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants