pat310 / google-trends-api

An API layer on top of google trends
https://www.npmjs.com/package/google-trends-api
MIT License
874 stars 174 forks source link

TypeScript Support #148

Open harshlodhi82 opened 3 years ago

harshlodhi82 commented 3 years ago

Hi, I need to use this package with the TypeScript based node/express application but I think it doesn't support it yet, Please kindly give the support for the TypeScript. Thanks

Fohlen commented 3 years ago

@harshlodhi82 in the meantime you can build it yourself, e.g:

declare module 'google-trends-api' {
    export interface TrendOptions {
        keyword: string | string[],
        startTime?: Date,
        endTime?: Date,
        geo?: string | string[],
        hl?: string,
        timezone?: number,
        category?: number,
        property?: string,
        granularTimeResolution?: boolean
    }

    interface InterestOverTimeResult {
        "default": {
            "timelineData": [{
                "time": string,
                "formattedTime": string,
                "formattedAxisTime": string,
                "value": number[],
                "formattedValue": string[]
            }]
        }
    }

    export function interestOverTime(options: any): Promise<InterestOverTimeResult>;
}
harshlodhi82 commented 3 years ago

Thanks for the Help @Fohlen 👍