Skip to content

Commit

Permalink
types: replace declaration merging with mixin types
Browse files Browse the repository at this point in the history
  • Loading branch information
flakey5 committed Jan 19, 2024
1 parent 5de6d94 commit 841c06a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions types/index.d.ts
Expand Up @@ -2,18 +2,16 @@
// Leo <https://github.com/leomelzer>
/// <reference types="node" />

import { FastifyPluginAsync, FastifyRequest, RouteOptions } from 'fastify'
import { FastifyPluginAsync, FastifyRequest, RouteOptions, FastifyReply } from 'fastify'
import { Stats } from 'fs'

declare module 'fastify' {
interface FastifyReply {
sendFile(filename: string, rootPath?: string): FastifyReply;
sendFile(filename: string, options?: fastifyStatic.SendOptions): FastifyReply;
sendFile(filename: string, rootPath?: string, options?: fastifyStatic.SendOptions): FastifyReply;
download(filepath: string, options?: fastifyStatic.SendOptions): FastifyReply;
download(filepath: string, filename?: string): FastifyReply;
download(filepath: string, filename?: string, options?: fastifyStatic.SendOptions): FastifyReply;
}
export interface StaticReplyMixin {
sendFile(filename: string, rootPath?: string): FastifyReply;
sendFile(filename: string, options?: fastifyStatic.SendOptions): FastifyReply;
sendFile(filename: string, rootPath?: string, options?: fastifyStatic.SendOptions): FastifyReply;
download(filepath: string, options?: fastifyStatic.SendOptions): FastifyReply;
download(filepath: string, filename?: string): FastifyReply;
download(filepath: string, filename?: string, options?: fastifyStatic.SendOptions): FastifyReply;
}

type FastifyStaticPlugin = FastifyPluginAsync<NonNullable<fastifyStatic.FastifyStaticOptions>>;
Expand Down

0 comments on commit 841c06a

Please sign in to comment.