Skip to content

Commit 841c06a

Browse files
committed
types: replace declaration merging with mixin types
Background: fastify/fastify#5061
1 parent 5de6d94 commit 841c06a

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

types/index.d.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
// Leo <https://github.com/leomelzer>
33
/// <reference types="node" />
44

5-
import { FastifyPluginAsync, FastifyRequest, RouteOptions } from 'fastify'
5+
import { FastifyPluginAsync, FastifyRequest, RouteOptions, FastifyReply } from 'fastify'
66
import { Stats } from 'fs'
77

8-
declare module 'fastify' {
9-
interface FastifyReply {
10-
sendFile(filename: string, rootPath?: string): FastifyReply;
11-
sendFile(filename: string, options?: fastifyStatic.SendOptions): FastifyReply;
12-
sendFile(filename: string, rootPath?: string, options?: fastifyStatic.SendOptions): FastifyReply;
13-
download(filepath: string, options?: fastifyStatic.SendOptions): FastifyReply;
14-
download(filepath: string, filename?: string): FastifyReply;
15-
download(filepath: string, filename?: string, options?: fastifyStatic.SendOptions): FastifyReply;
16-
}
8+
export interface StaticReplyMixin {
9+
sendFile(filename: string, rootPath?: string): FastifyReply;
10+
sendFile(filename: string, options?: fastifyStatic.SendOptions): FastifyReply;
11+
sendFile(filename: string, rootPath?: string, options?: fastifyStatic.SendOptions): FastifyReply;
12+
download(filepath: string, options?: fastifyStatic.SendOptions): FastifyReply;
13+
download(filepath: string, filename?: string): FastifyReply;
14+
download(filepath: string, filename?: string, options?: fastifyStatic.SendOptions): FastifyReply;
1715
}
1816

1917
type FastifyStaticPlugin = FastifyPluginAsync<NonNullable<fastifyStatic.FastifyStaticOptions>>;

0 commit comments

Comments
 (0)