Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type of response for GetRecordingStatus leads to a possible undefined recordingFilename and recordTimecode #276

Open
florianpasteur opened this issue Feb 3, 2022 · 0 comments

Comments

@florianpasteur
Copy link

florianpasteur commented Feb 3, 2022

Description:

Hi,

According to the documentation when getting the GetRecordingStatus, if OBS is recording both recordTimecode and recordingFilename properties should be populated. With the current type definition the both properties can be undefined and throw a type error, see the following snippet of code.

import OBSWebSocket from "obs-websocket-js";

const obs = new OBSWebSocket();

obs.send("GetRecordingStatus").then(status => {
    if (status.isRecording) {
        // TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
        // Type 'undefined' is not assignable to type 'string'.
        fnWithMandatoryString(status.recordingFilename);
    }
})

function fnWithMandatoryString(someString: string) {
    // whatever
}

Versions Used (if applicable):

  • obs-websocket-js version: 4.0.3
  • node version: 14.18.1
  • typescript version: 4.5.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant