Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/express-ws) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Installation
npm install --save @types/express-ws
Summary
This package contains type definitions for express-ws (https://github.com/HenningM/express-ws).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-ws.
index.d.ts
import express = require("express");
import * as core from "express-serve-static-core";
import * as http from "http";
import * as https from "https";
import ws = require("ws");
declare module "express" {
function Router(options?: RouterOptions): expressWs.Router;
}
declare function expressWs(
app: express.Application,
server?: http.Server | https.Server,
options?: expressWs.Options,
): expressWs.Instance;
declare namespace expressWs {
type Application = express.Application & WithWebsocketMethod;
type Router = express.Router & WithWebsocketMethod;
interface Options {
leaveRouterUntouched?: boolean | undefined;
wsOptions?: ws.ServerOptions | undefined;
}
interface RouterLike {
get: express.IRouterMatcher<this>;
[key: string]: any;
[key: number]: any;
}
interface Instance {
app: Application;
applyTo(target: RouterLike): void;
getWss(): ws.Server;
}
type WebsocketRequestHandler = (ws: ws.WebSocket, req: express.Request, next: express.NextFunction) => void;
type WebsocketMethod<T> = (route: core.PathParams, ...middlewares: WebsocketRequestHandler[]) => T;
interface WithWebsocketMethod {
ws: WebsocketMethod<this>;
}
}
export = expressWs;
Additional Details
- Last updated: Fri, 24 Oct 2025 04:02:41 GMT
- Dependencies: @types/express, @types/express-serve-static-core, @types/ws
Credits
These definitions were written by AJ Livingston.