Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include latest @types/cheerio #170

Merged
merged 1 commit into from
Sep 7, 2021
Merged

Conversation

hideo54
Copy link
Contributor

@hideo54 hideo54 commented May 28, 2021

Closes #157.

Hi, thanks for the awesome product!

As pointed out in the issue #157, some type errors occur when you use scrape-it with TypeScript. That's because this product does not include @types/cheerio in dependencies. Moreover, old definitions in @types/cheerio are used in lib/index.d.ts so that installing the latest @types/cheerio does not help.

To reproduce the errors, you just need to:

  • Run npm ci and do nothing else
  • Write a very simple TypeScript program in which ./lib is imported.
  • Run tsc and you will see the errors

Here I made some changes:

  • Install the latest @types/cheerio
  • Fix lib/index.d.ts

I confirmed that these changes successfully pass a simple build task without errors.

There will be other ways to fix the issue, such as making some changes to use the latest cheerio (officially typed!) instead of installing @types/cheerio. That will be fine, but I think my proposal is the easiest way to fix the problem.

@cheeplusplus
Copy link
Contributor

There's no reason to use @types/cheerio anymore, newer versions of cheerio have types included.

@hideo54
Copy link
Contributor Author

hideo54 commented Jun 10, 2021

Right, that's another solution. However, scrape-it does not use cheerio, instead it uses cheerio-req, which depends on old cheerio without types, so it's more complex to modify. I made this pull request for the purpose of quick fix.

@hideo54
Copy link
Contributor Author

hideo54 commented Aug 24, 2021

Hi, what do you think about this pull request? @IonicaBizau

@IonicaBizau IonicaBizau merged commit e9e8409 into IonicaBizau:master Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find name Cheerio / CheerioSelector / CheerioStatic
3 participants