obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
667 stars 96 forks source link

TypeScript definition for `EventHandlersDataMap` doesn't include `error` #203

Closed roncli closed 3 years ago

roncli commented 4 years ago

Description:

The TypeScript definition for EventHandlersDataMap does not include a key for error, resulting in Visual Studio Code showing an error on this statement:

obs.on("error", (err) => {
    console.log(err);
});

The error:

Argument of type '"error"' is not assignable to parameter of type '"ConnectionOpened" | "ConnectionClosed" | "AuthenticationSuccess" | "AuthenticationFailure" | "SwitchScenes" | "ScenesChanged" | "SceneCollectionChanged" | "SceneCollectionListChanged" | ... 43 more ... | "StudioModeSwitched"'.

I think that just adding error: Error; to EventHandlersDataMap in index.d.ts should resolve it, but am not familiar enough with TS to know if that actually is a valid solution.

Versions Used (if applicable):