API Docs do not match Typescript Declaration File

Issue Description:
I switched from an old .d.ts file to the updated .d.ts file in the @overwolf/types package and I noticed there are some issues.

  1. The types file doesn’t always match the API docs.

For example, the StopStreamingEvent object has a success and total_frames property in the docs, but the types files doesn’t have these two.

Which one of these are correct?

overwolf.d.ts file:

  interface StopStreamingEvent {
    stream_id: number;
    url: string;
    file_path: string;
    duration: number;
    last_file_path: string;
    split: boolean;
    extra: string;
    osVersion: string;
    osBuild: string;
  }

Overwolf Docs:

Using the old types file, the onStopStreaming looks like below:

    interface OnStopStreamingResultSuccess {
      success: true;
      stream_id: number;
      url: string;
      file_path: string;
      duration: number;
      last_file_path: string;
      split: boolean;
      extra: any;
      osVersion: string;
      osBuild: string;
    }

    interface OnStopStreamingResultError {
      success: false;
    }

    type OnStopStreamingResult = OnStopStreamingResultSuccess | OnStopStreamingResultError;

    /**
     * Fired when the stream has stopped.
     */
    abstract class onStopStreaming implements OWEvent {
      static addListener(callback: (payload?: OnStopStreamingResult) => void): void;
      static removeListener(callback: (payload?: OnStopStreamingResult) => void): void;
    }

The new file says the callback provides the StopStreamingEvent object instead, which doesn’t have a success property for us to check.

  1. The use of const enum makes it impossible to actually use the types because they get compiled to just the number literals.

references:

  1. This last one isn’t an issue per se, but it would make using the types a lot easier if we didn’t need to put import '@overworlf/types on every file we need to use the types. If the types file are merged into the DefinitelyTyped repo, Typescript can automatically get the correct types without the need for importing.

Hi, and thanks for the feedback.

We will check the issue and we will update you here.

Thanks.

@Flics Hi,

regarding the success field - just the callbacks inherited from the result object, which contains this field. Not the events. So that’s a mistake in the docs, not in the typedef file. So I fixed it in the dev site.
The other missing field was added to the def file (total_frames).

We are trying to make it perfect, but as it’s written manually, mistakes like that can happen. So thanks for reporting. As mentioned, it is fixed now.

Regarding to the other two issues: enums and DefinitelyTyped repo - I will check it and answer.

Thanks

Update: we discuss the above internally as we think to do shortly couple of enhancements in these areas. I will keep you updated on the announcements channel and the changelog.

For now, I think it’s better to go ahead and close this ticket. Thanks.