jshemas / openGraphScraper

Node.js scraper service for Open Graph Info and More!
MIT License
669 stars 105 forks source link

Types Errors #179

Closed nekochan0122 closed 1 year ago

nekochan0122 commented 1 year ago

Screenshots

image

image

wfischer42 commented 1 year ago

@nekochan0122, I'm having this exact issue. Were you able to fix it? I assumed it had to do with tsconfig exclude settings, but no config I've tried has worked...

I'm using turborepo and yarn workspaces, so it might have something to do with those for my case.

jshemas commented 1 year ago

Please list the steps to reproduce the problem. (post a code example with your tsconfig)

wfischer42 commented 1 year ago

Ok, it seems to have nothing to do with my tsconfig, and more to do with how this package's types are configured. https://github.com/microsoft/TypeScript/issues/44205

Reproduction steps:

  1. Start a turborepo project (https://turbo.build/repo/docs/getting-started/create-new)
  2. Add open-graph-scraper to /apps/web
  3. Import and call it in an API route
  4. Attempt to build the project

yarn tsc and yarn build fails. Everything works fine if I revert to version 5.0.3 or 4.x.x. (haven't tried other 5.x.x versions, except that it didn't work in 5.1.1, though it threw different errors)

Turborepo uses internal package dependencies via yarn workspaces (or whatever package manager you choose) for things like shared tsconfig files. node_modules is included in the exclude field, but I get a handful of type errors from this package (and only this package) anyway.

jshemas commented 1 year ago

I have no clue what Turborepo is and it only made a front end app for me... So i'm not sure how to reproduce this problem. Please upload a example repo with this problem.

jshemas commented 1 year ago

I believe I have fixed the type issues in open-graph-scraper@5.2.3. Please open a new issue if you have anymore problems.

nekochan0122 commented 1 year ago

@nekochan0122, I'm having this exact issue. Were you able to fix it? I assumed it had to do with tsconfig exclude settings, but no config I've tried has worked...

I didn't fix it, I use cheerio to write my own scrape OG 🤣

image