Skip to content

Commit

Permalink
chore: adjust types
Browse files Browse the repository at this point in the history
  • Loading branch information
jpina1-godaddy committed Mar 7, 2025
1 parent 056e73d commit f0d3259
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
8 changes: 0 additions & 8 deletions packages/gasket-plugin-fastify/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ declare module '@gasket/core' {
fastify?: FastifyConfig
}

/**
* Handler function type - The middie middleware is added for express
* compatibility
*/
type Handler = (req: any, res: any, next: (error?: Error) => void) => void;

/** Error handler function type */
type ErrorHandler = (
Expand All @@ -45,9 +40,6 @@ declare module '@gasket/core' {
) => void;

export interface HookExecTypes {
middleware(
app: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProviderDefault>
): MaybeAsync<MaybeMultiple<Handler> & { paths?: (string | RegExp)[] }>;
fastify(app: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProviderDefault>): MaybeAsync<void>;
errorMiddleware(): MaybeAsync<MaybeMultiple<ErrorHandler>>;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/gasket-plugin-https-proxy/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Plugin, MaybeAsync } from '@gasket/core';
import type { ServerOptions as ProxyServerOptions, Server as ProxyServer } from 'http-proxy';
import type { ServerOptions as ProxyServerOptions } from 'http-proxy';
import ProxyServer from 'http-proxy';
import type { RequireAtLeastOne } from '@gasket/plugin-https';

interface BaseHttpsProxyConfig extends ProxyServerOptions {
Expand Down
12 changes: 8 additions & 4 deletions packages/gasket-plugin-middleware/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { Plugin, MaybeAsync, MaybeMultiple, Handler } from '@gasket/core';
import type { Plugin, MaybeAsync, MaybeMultiple, Gasket } from '@gasket/core';
import type { FastifyInstance } from 'fastify'
import type { Application as ExpressApplication } from 'express';

declare module 'fastify' {
interface FastifyReply {
Expand Down Expand Up @@ -37,11 +39,13 @@ declare module 'express-serve-static-core' {
}
}

export type Handler = (req: any, res: any, next: (error?: Error) => void) => void;

type App = FastifyInstance | ExpressApplication;

declare module '@gasket/core' {
export interface HookExecTypes {
middleware(): MaybeAsync<MaybeMultiple<Handler> & {
paths?: (string | RegExp)[]
}>;
middleware(gasket: Gasket, app: App): MaybeAsync<MaybeMultiple<Handler> >;
}

export interface GasketConfig {
Expand Down
3 changes: 2 additions & 1 deletion packages/gasket-plugin-middleware/lib/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import type {
FastifyBaseLogger,
RawServerDefault
} from 'fastify';
import type { Gasket, Plugin, MaybeMultiple, Handler } from '@gasket/core';
import type { Gasket, Plugin, MaybeMultiple } from '@gasket/core';
import type { Handler } from './index';

/** Type alias for Fastify application with HTTP/2 support */
type FastifyApp<
Expand Down
1 change: 1 addition & 0 deletions packages/gasket-plugin-morgan/lib/middleware.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="@gasket/plugin-express" />
/// <reference types="@gasket/plugin-logger" />
/// <reference types="@gasket/plugin-middleware" />

const morgan = require('morgan');
const split = require('split');
Expand Down

0 comments on commit f0d3259

Please sign in to comment.