Home > OS >  Declary Countly.q.push inside Typescript declaration file
Declary Countly.q.push inside Typescript declaration file

Time:07-08

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

CodePudding user response:

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;
}
  • Related