Skip to content

docs: clarify TypeScript plugin styles#294

Open
barry166 wants to merge 1 commit into
fastify:mainfrom
barry166:docs/typescript-plugin-style
Open

docs: clarify TypeScript plugin styles#294
barry166 wants to merge 1 commit into
fastify:mainfrom
barry166:docs/typescript-plugin-style

Conversation

@barry166

Copy link
Copy Markdown

Summary

  • Documents that TypeScript plugins should not mix callback and async styles.
  • Calls out that async plugins should not accept/use done, while callback plugins should not be declared async.

Fixes #221.

Verification

  • npm test
  • npm run lint
  • git diff --check

Contribution notes

  • AI-assisted: yes, Codex helped prepare this documentation change.
  • Human reviewed: yes, I reviewed the final diff and test output before opening this PR.
  • Duplicate check: issue Development references are empty; related PR search found only merged PR fix inferring the correct fn type #218 and no open competing docs PR.

The TypeScript guidance shows callback and async examples but does not explicitly state that mixing async functions with the done callback is invalid. Users hit this after the stricter 4.5.1 typing change, so document the intended split next to the existing examples.

Constraint: fastify#221 asks for docs around the 4.5.1 TypeScript behavior
Rejected: Add more type examples | the existing examples are enough; the missing piece is the explicit do-not-mix rule
Confidence: high
Scope-risk: narrow
Directive: Keep this guidance aligned with FastifyPluginCallback vs FastifyPluginAsync semantics
Tested: npm test; npm run lint; git diff --check
Not-tested: none
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.

Update the documentation to reflect typescript changes from v 4.5.1

1 participant