Skip to content

error TS2344: Type 'ws' does not satisfy the constraint 'abstract new (...args: any) => any' #1320

@deyaaeldeen

Description

@deyaaeldeen

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

Typechecking code that imports openai websocket client fails with the following error:

node_modules/openai/beta/realtime/websocket.d.ts:7:19 - error TS2344: Type 'ws' does not satisfy the constraint 'abstract new (...args: any) => any'.

7 }) ? InstanceType<ws> : any;
                    ~~

  node_modules/openai/beta/realtime/websocket.d.ts:6:22
    6     WebSocket: infer ws;
                           ~~
    This type parameter might need an `extends abstract new (...args: any) => any` constraint.

To Reproduce

repro link

Code snippets

OS

any

Node version

Node v23

Library version

openai v4.84.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions