简体   繁体   中英

Declary Countly.q.push inside Typescript declaration file

How I can declare Countly push add_event method like this:

Countly.q.push(['add_event',{
  "key":"action_open_web",
}]);

inside declaration file (.d.ts). I tried this and does not work:

declare module 'countly-sdk-web' {
    export function q.push(
        [string, {key: string,}]
    ): void;
}

Reference: Countly-sdk-web

Something like this?

declare module 'countly-sdk-web' {
    type Event = [string, Record<string, string>]
    interface ICountly {
        q: Array<Event>
    }
    const Countly: ICountly
    export default Countly;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM