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'