Missing the types of Cheerio, CheerioSelector and CheerioStatic
saltyshiomix opened this issue · 4 comments
saltyshiomix commented
I found no declarations in the index.d.ts
(v5.1.4
):
(Cheerio
, CheerioSelector
and CheerioStatic
)
declare namespace scrapeIt {
export interface ScrapeOptions {
[key: string]: string | ScrapeOptionList | ScrapeOptionElement;
}
export interface ScrapeOptionElement {
selector?: string;
convert?: (value: any) => any;
how?: string | ((element: CheerioSelector) => any);
attr?: string;
trim?: boolean;
closest?: string;
eq?: number;
texteq?: number;
}
export interface ScrapeOptionList {
listItem: string;
data?: ScrapeOptions;
convert?: (value: any) => any;
}
export interface ScrapeResult<T> {
data: T,
$: Cheerio,
response: any,
body: string
}
export function scrapeHTML<T>(body: CheerioStatic | string, options: ScrapeOptions): T;
}
declare function scrapeIt<T>(url: string | object, opts: scrapeIt.ScrapeOptions): Promise<scrapeIt.ScrapeResult<T>>;
declare function scrapeIt<T>(url: string | object, opts: scrapeIt.ScrapeOptions, cb: (err: any, res: scrapeIt.ScrapeResult<T>) => void): void;
export = scrapeIt;
I think we should import types from cheerio
.
Any other ideas?
In advance, this awesome tool I'm so glad to use :)
Thank you for your great works.
saltyshiomix commented
Currently I'm avoiding this issue by adding @types/cheerio
in my projects' devDependencies.
saltyshiomix commented
I think we should add @types/cheerio
in the dependencies instead of devDependencies :)
saltyshiomix commented
I tested both yarn install
and npm install
, but both of them have same errors.
IonicaBizau commented
Probably fixed via #137