Skip to content

Add comprehensive TypeScript type tests using tsd#2

Merged
mcollina merged 9 commits intomainfrom
add-typescript-type-tests
Aug 25, 2025
Merged

Add comprehensive TypeScript type tests using tsd#2
mcollina merged 9 commits intomainfrom
add-typescript-type-tests

Conversation

@mcollina
Copy link
Copy Markdown
Member

Summary

  • Adds comprehensive TypeScript definition testing using the tsd library
  • Ensures type safety and validates all plugin interfaces work correctly
  • Tests plugin options, SSE messages, reply interface, and route options

Changes

  • Install tsd and TypeScript for type testing infrastructure
  • Create comprehensive type test file covering all exported interfaces
  • Update TypeScript definitions to properly import and extend Fastify types
  • Add npm run test:types script for running type tests

Test plan

  • Type tests pass with npm run test:types
  • All existing tests still pass with npm test
  • Linting passes with npm run lint

🤖 Generated with Claude Code

mcollina and others added 9 commits August 15, 2025 08:35
…management

- Add comprehensive SSE message formatting with multiline support
- Implement streaming support for async generators and Node.js streams
- Add connection lifecycle management with keepAlive and close handlers
- Support message replay functionality with Last-Event-ID header
- Include configurable heartbeat mechanism for connection health
- Add route-level SSE configuration with fallback to regular handlers
- Provide TypeScript definitions for full type safety
- Include comprehensive test coverage for all features
- Add working examples demonstrating plugin capabilities
- Align reply.sse.send() and reply.sse.stream() method signatures with agreed design
- Update API documentation and examples to reflect final implementation
- Ensure compatibility with Fastify's request/reply lifecycle patterns
- Standardize method interfaces based on community discussion outcomes
- Remove trailing whitespace and add missing newlines for linting compliance
- Update Windows test command to explicitly list test files instead of using glob patterns
- Ensure all files meet Standard.js formatting requirements
The README was incorrectly showing reply.sse() which would cause runtime errors.
Updated all examples to use the correct reply.sse.send() API that matches the
actual implementation. This fixes critical documentation errors that would
prevent users from successfully using the plugin.
- Replace standard dependency with eslint and neostandard
- Update lint scripts to use eslint instead of standard
- Add eslint.config.js with neostandard configuration
- Maintains same code style rules through neostandard preset
- Install tsd for TypeScript definition testing
- Add comprehensive type test file covering plugin options, SSE messages, reply interface, and route options
- Update type definitions to import FastifyPluginAsync and extend RouteShorthandOptions
- Add npm script for running type tests

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolved conflicts:
- package.json: Combined type test dependencies with main branch
- types/index.d.ts: Kept RouteShorthandOptions interface and FastifyPluginAsync import
- index.js: Used non-async writeToStream method from main branch

All tests and type checks pass.
@mcollina mcollina merged commit 41d10e6 into main Aug 25, 2025
23 checks passed
@mcollina mcollina deleted the add-typescript-type-tests branch August 25, 2025 22:05
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.

1 participant