You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently started using scrape-it to extract data from html pages, but there were cases where I needed to intervene in the extraction using the Cheerio API.
// test exampleconstanyHTML='<html>...</html>'const{ data }=scrapeIt.scrapeHTML<{data: unknown}>(anyHTML,{data: {listItem: 'main',data: {items: {selector: 'article',how: (element)=>{const$items=element.find('p:nth-child(n+2)')// more cheerio methodsreturn$items.text()}}}}})
The problem
TypeScript throws a typing warning, if you run the code nothing happens, but it becomes a nuisance to have that warning and not have autocompletion with the Cheerio object passed to the function parameter.
Solución
Looking into the types of scrape-it, the how field has as its type a function whose parameter is a cheerio.Selector, which may cause the problem.
A little context
I recently started using scrape-it to extract data from html pages, but there were cases where I needed to intervene in the extraction using the Cheerio API.
The problem
TypeScript throws a typing warning, if you run the code nothing happens, but it becomes a nuisance to have that warning and not have autocompletion with the Cheerio object passed to the function parameter.

Solución
Looking into the types of scrape-it, the
how
field has as its type a function whose parameter is acheerio.Selector
, which may cause the problem.The text was updated successfully, but these errors were encountered: