apify / got-scraping

HTTP client made for scraping based on got.
526 stars 40 forks source link

Typescript options error #66

Closed nickluger closed 1 year ago

nickluger commented 2 years ago

This starter example from the docs:

gotScraping
    .get({
        url: 'https://apify.com',
        proxyUrl: 'http://usernamed:password@myproxy.com:1234',
    })

leads to the following TS error on TS v4.6.2

TS2769: No overload matches this call.   
The last overload gave the following error.     
Argument of type '{ url: string; proxyUrl: string; }' is not assignable to parameter of type 'OptionsInit'.       
Object literal may only specify known properties, and 'proxyUrl' does not exist in type 'OptionsInit'.

The same happen for any other got-scraping-provided context fields like useHeaderGenerator.

Using version 3.2.8 of this package (for some reason, the latest git tag isv3.7.8, but I assume that's the same?)

aN00B1s commented 2 years ago

May you check this problem please? @szmarczak

szmarczak commented 2 years ago

This is currently blocked by https://github.com/sindresorhus/got/issues/1117. If you didn't use the .get shortcut, it should work. Or you can force-cast it (not recommended).

founderblocks-sils commented 2 years ago

@szmarczak how would such a workaround look like? Having the same issue here.

meotimdihia commented 1 year ago

@szmarczak I still get the error even though I didn't use the .get image

vladfrangu commented 1 year ago

This was solved by #88 and will be available in the next release 🎉

B4nan commented 1 year ago

This was solved by https://github.com/apify/got-scraping/pull/88 and will be available in the next release 🎉

This reminds me - please always link the issue from PR so its closed automatically as well as linked in the changelog.

(but I guess we found out "again" about this on slack, right)