I'am new to typescript and trying to fix index.d.ts typescript declaration file for fastify-static plugin
index.d.ts looks like this:
import fastify = require("fastify");
import { Server, IncomingMessage, ServerResponse } from "http";
import { Http2SecureServer, Http2ServerRequest, Http2ServerResponse } from "http2"
declare module "fastify" {
interface FastifyReply<HttpResponse> {
sendFile(filename: string): FastifyReply<HttpResponse>;
}
}
declare const fastifyStatic: fastify.Plugin<Server, IncomingMessage, ServerResponse , {
root: string;
prefix?: string;
serve?: boolean;
decorateReply?: boolean;
schemaHide?: boolean;
setHeaders?: (...args: any[]) => void;
redirect?: boolean;
wildcard?: boolean | string;
// Passed on to `send`
acceptRanges?: boolean;
cacheControl?: boolean;
dotfiles?: boolean;
etag?: boolean;
extensions?: string[];
immutable?: boolean;
index?: string[];
lastModified?: boolean;
maxAge?: string | number;
}>;
export = fastifyStatic;
I need to change this declaration file so const fastifyStatic will accept interfaces
Server, IncomingMessage, ServerResponse
or
Http2SecureServer, Http2ServerRequest, Http2ServerResponse
Problem is that i can't really understand syntaxis of datatype:
fastify.Plugin<Interface, Interface, {}>
I would appreciate explanation of this or some documentation link.