From 40f3135742e05901ac7d03cfd986537ebb52da01 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Tue, 19 Mar 2024 11:16:43 +0100 Subject: [PATCH] Re-export WebSocket Signed-off-by: Matteo Collina --- types/index.d.ts | 2 ++ types/index.test-d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index d75546e..20aed8c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -98,6 +98,8 @@ declare namespace fastifyWebsocket { Logger extends FastifyBaseLogger = FastifyBaseLogger > extends fastify.RouteOptions, WebsocketRouteOptions { } + export type WebSocket = WebSocket.WebSocket; + export const fastifyWebsocket: FastifyWebsocket export { fastifyWebsocket as default } } diff --git a/types/index.test-d.ts b/types/index.test-d.ts index f7a242e..c497a90 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -1,8 +1,8 @@ -import fastifyWebsocket, { WebsocketHandler, fastifyWebsocket as namedFastifyWebsocket, default as defaultFastifyWebsocket } from '..'; +import fastifyWebsocket, { WebsocketHandler, fastifyWebsocket as namedFastifyWebsocket, default as defaultFastifyWebsocket, WebSocket } from '..'; import type { IncomingMessage } from "http"; import fastify, { RouteOptions, FastifyRequest, FastifyInstance, FastifyReply, RequestGenericInterface, FastifyBaseLogger, RawServerDefault, FastifySchema, RawRequestDefaultExpression } from 'fastify'; import { expectType } from 'tsd'; -import { Server, WebSocket } from 'ws'; +import { Server } from 'ws'; import { RouteGenericInterface } from 'fastify/types/route'; import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox'; import { Type } from '@sinclair/typebox'