Skip to content

Conversation

@williamfds
Copy link
Contributor

@williamfds williamfds commented May 29, 2025

Summary

This PR improves the README.md by adding a clear and minimal TypeScript usage example, aligning with the plugin's existing TypeScript support.

What's Changed

  • Added a dedicated section for TypeScript usage
  • Included a type-safe compression example with reply.compress
  • Ensured consistency with the rest of the documentation

Motivation

Many developers using Fastify rely on TypeScript. While the plugin is compatible, the README lacked a direct TypeScript example. This addition makes it easier for TypeScript users to understand how to integrate @fastify/compress effectively.


Checklist

  • Documentation was updated (README.md)
  • Commit message follows the Developer's Certification of Origin
  • Run npm run test and npm run benchmark (not applicable to docs-only change)
  • Tests and/or benchmarks are included (not applicable)

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's Changed

  • Added complete usage examples for both compression and decompression
  • Clarified per-route and global configuration
  • Improved formatting and consistency
  • Fixed minor typos and outdated content
  • Ensured compatibility with TypeScript examples

Motivation

This update provides clearer guidance for new users and better illustrates advanced use cases like inflateIfDeflated, removeContentLengthHeader, and customTypes.

I don't see any of that in this change set. All I see is the addition of a TypeScript example.

@williamfds
Copy link
Contributor Author

Hi @jsumners

Thanks for the initial review!

I've now updated the PR with:

  • A new Usage Highlights section covering advanced features like:
    • inflateIfDeflated
    • removeContentLengthHeader
    • customTypes using both regex and function

Let me know if you think it’s ready or if you'd like any further adjustments.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@Fdawgs Fdawgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I'm -1 on this as it duplicates content already present in the readme, just under a TypeScript label.

I don't think this is worth increasing the length of the readme by ~20% for; I'd rather the readme be as lean as possible so users don't have to scroll for 10 seconds like in fastify-swagger.
We've already got types/index.d.ts and types in package.json, which clearly signals TypeScript support.

Happy to revisit if there's a way to provide meaningful TS-specific guidance without duplicating existing examples.

@ilteoood
Copy link

@Fdawgs considering your comment, and the amount of months ago that this has been opened, should we consider closing it?

@Fdawgs
Copy link
Member

Fdawgs commented Oct 25, 2025

@Fdawgs considering your comment, and the amount of months ago that this has been opened, should we consider closing it?

I'm happy to close it if others are.

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.

5 participants