function adaptWsModule
Since 0.2.0
adaptWsModule(module: unknown): WsModuleLike

Narrows an already-imported module to WsModuleLike.

Split from loadWsModule so the validation branches are unit-testable with a hand-built fake, leaving only the one import() line behind a guarded real-import test.

Examples

Example 1

import * as ws from 'ws';
const adapter = new NodeHttpAdapter(undefined, adaptWsModule(ws));

Parameters

module: unknown

The imported module namespace

Return Type

The narrowed module

Throws

TypeError

If the module does not expose a WebSocketServer constructor

Usage

import { adaptWsModule } from "runtime/src/index.ts";