Skip to content

Cannot use namespace 'EventEmitter' as a type. #335

Closed
@YpsilonTM

Description

@YpsilonTM

So this is my code and I keep getting the error that EventEmitter cannot be used as a type.
I remove my node modules folder did a clean install. Anyone have a clue why it keeps complaining about that?

import OBSWebSocket from 'obs-websocket-js'
import { OBS_SETTINGS } from '../config.js'

class OBS {
  private socketURL: string
  private socket: OBSWebSocket

  constructor() {
    this.socketURL = OBS_SETTINGS.getSocketURL()
  }

  public async connect() {
    this.socket = new OBSWebSocket()
    return await this.socket.connect(this.socketURL)
  }
}

The Error:

node_modules/obs-websocket-js/dist/base.d.ts:23:56 - error TS2507: Type 'typeof import("D:/Development/silon-server-twitch/node_modules/eventemitter3/index")' is not a constructor function type.

23 export declare abstract class BaseOBSWebSocket extends EventEmitter<MapValueToArgsArray<EventTypes>> {
                                                          ~~~~~~~~~~~~

node_modules/obs-websocket-js/dist/base.d.ts:27:34 - error TS2709: Cannot use namespace 'EventEmitter' as a type.

27     protected internalListeners: EventEmitter<string | symbol, any>;
                                    ~~~~~~~~~~~~


Found 2 errors in the same file, starting at: node_modules/obs-websocket-js/dist/base.d.ts:23

Versions Used:

  • obs-websocket-js version: 5.0.3
  • node version: v18.14.1

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