Skip to content

importing the module doesn't work like shown in the readme for TypeScript projects #1932

@hood

Description

@hood
  • I've searched for any related issues and avoided creating a duplicate
    issue.

Description

The module must be imported with
import * as WebSocket from 'ws';
while the readme shows the module being imported with
import WebSocket, { WebSocketServer } from 'ws';

Reproducible in:

Any TypeScript project.

Steps to reproduce:

  1. install ws

  2. import it like import WebSocket, { WebSocketServer } from 'ws'; in a project

  3. try using the module as expected

Expected result:

The module can be imported as shown in the readme.

Actual result:

The module must be imported in alternative ways.

Attachments:

Just try running this piece of code

import WebSocket, { WebSocketServer } from 'ws';

const WSServer = new WebSocketServer();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions