Add TS support for the webOS API

Hi there!

I created for a current company project a module definition for the webOS API. I would love to contribute but I couldn’t find any official repository for webOS, so I am dropping here the typing for anyone to enjoy it

/** All the data has been extracted from https://webostv.developer.lge.com/develop/references/webostvjs-webos#webos-api */
declare global {
    interface Window {
        /** The webOS API provides methods for retrieving TV-specific information and settings.
         * Methods of this API is compatible with methods of the webOS.js library used on the previous versions of webOS TV. */
        webOS: {
            /** Holds properties representing the build version of the webOSTV.js library.
             *  for example 1.2.4 */
            libVersion: string;
            /** Holds properties representing the platform identification of webOS variants.
             *  for example { tv: true, chrome: 87 } */
            platform: 'unknown' | { tv: boolean; chrome?: number };
            /** Returns the device-specific information. */
            deviceInfo: {
                /** The model name of the device in UTF-8 format. */
                modelName: string;
                /** The full name of TV SW version.
                 *  You can check the value in the software version of the TV Settings menu. */
                version: string;
                /** The subset of TV SW version: Major version number. */
                versionMajor: number;
                /** The subset of TV SW version: Minor version number. */
                versionMinor: number;
                /** The subset of TV SW version: Revision version number. */
                versionDot: number;
                /** The webOS TV SDK version in X.X.X format. *
                 *  You can check the value in the webOS TV version of the TV Settings menu. */
                sdkVersion: string;
                /** The screen width in pixels for video playback.
                 *  For the app resolution (width) for graphics display, use window.innerWidth. */
                screenWidth: number;
                /** The screen height in pixels for video playback.
                 *  For the app resolution (height) for graphics display, use window.innerHeight. */
                screenHeight: number;
                /** Indicates whether the device supports Ultra HD resolution. */
                uhd: boolean;
                /** Indicates whether the device supports 8K UHD resolution. */
                uhd8K: boolean;
                /** Indicates whether the display type of device is OLED or not. */
                oled: boolean;
                /** The size of DDR DRAM in Bytes. For example, if the size of DDR DRAM is 3G, the return value is '3G'. */
                ddrSize: boolean;
                /** Indicate whether the device supports HDR10. */
                hdr10: boolean;
                /** Indicate whether the device supports Dolby Vision. */
                dolbyVision: boolean;
                /** Indicate whether the device supports Dolby Atmos. */
                dolbyAtmos: boolean;
            };
            /** Returns the app ID of the caller app.
             *  For example "com.onair.app" */
            fetchAppId: () => string;
            /** Returns the appinfo.json data of the caller app with a cache saved to webOS.appInfo. */
            fetchAppInfo: () => unknown;
            /** Returns the full URI path of the caller app.
             *  for example "file:///Users/admin/projects/onair_frontend-rn/web/build/" */
            fetchAppRootPath: () => string;
            /** Emulates the back key of the remote controller to move backward 1 level. */
            platformBack: () => void;
            /** Returns the system-specific information.
             *  for example: { country: "ESP", smartServiceCountry: "ESP", timezone: "CET" } */
            systemInfo?: {
                /** The country that TV broadcasts. If the value does not exist, undefined is returned */
                country?: string;
                /** The country where the Smart service is provided. If the value does not exist, undefined is returned. */
                smartServiceCountry?: string;
                /** The time zone that TV broadcasts. If the value does not exist, undefined is returned. */
                timezone?: string;
            };
            /** Indicates whether the virtual keyboard is displayed or hidden. */
            keyboard: { isShowing: () => boolean };
            /** Creates and sends a service request to the system of the webOS TV. */
            service: {
                request: (
                    /** The service URI.
                     *  It accepts the normal service URI format, as well as the extended format with the service method included. */
                    uri: string,
                    /** eslint-disable-next-line unicorn/prevent-abbreviations */
                    parameter?: {
                        /** The service method being called. */
                        method?: string;
                        /** The JSON object of the request parameters to send. */
                        parameters?: unknown;
                        /** Indicates whether a subscription is desired for this request. */
                        subscribe?: boolean;
                        /** Indicates whether the request should resubscribe after a failure has occurred. */
                        resubscribe?: boolean;
                        /** The callback function called when the method succeeds. */
                        onSuccess?: () => void;
                        /** The callback function called when the method fails. */
                        onFailure?: () => void;
                        /** The callback function called when a request is complete (regardless of success or failure). */
                        onComplete?: () => void;
                    },
                ) => {
                    /** Resulting request object. This object can be used to cancel subscriptions. */
                    requestObject: {
                        /** The full-service request URI, including method name. */
                        uri: string;
                        /** The JSON object of the request parameters to send. */
                        params: unknown;
                        /** Indicates whether a subscription is desired for this request. */
                        subscribe: boolean;
                        /** Indicates whether the request should resubscribe after a failure has occurred. */
                        resubscribe: boolean;
                        /** The callback function called when the method succeeds. */
                        onSuccess: () => void;
                        /** The callback function called when the method fails. */
                        onFailure: () => void;
                        /** The callback function called when a request is complete (regardless of success or failure). */
                        onComplete: () => void;
                        /** Sends the request. It is automatically called on creation. No argument is required. */
                        send: () => void;
                        /** Cancels the service request and any associated subscription. No argument is required. */
                        cancel: () => void;
                        /** The JSON object containing the service's response data; either one of proper response data or error details. */
                        response?: unknown;
                        /** The JSON object containing the service's error details. */
                        error?: unknown;
                    };
                };
            };
        };
    }
}

Edit: I just found that it’s properly typed over here