serpapi / serpapi-javascript

Scrape and parse search engine results using SerpApi.
https://serpapi.com
MIT License
45 stars 4 forks source link

Type error occurs when 'google_images' is used for the engine value of the getJson function. #16

Open qwerq123456 opened 1 year ago

qwerq123456 commented 1 year ago

I use getJson function with engine value 'google_images' like below

const params = {
      api_key: process.env.SERPAPI_SECRET_KEY,
      q: query,
    } satisfies GoogleParameters;
const response = await getJson('google_images', params);

It works well but there is type error Argument of type '"google_images"' is not assignable to parameter of type 'keyof EngineMap'.

Can you add google_images in EngineMap?

rolandtolnay commented 1 year ago

Got the same error also on not finding GoogleImagesParameters after copying the code export from the Playground

zyc9012 commented 11 months ago

@qwerq123456 @rolandtolnay

We've removed engine-specific types for the new 2.0.0 release, as it's not practical to update this library every time we have engine updates in our service. The online documentation should be the only reference for valid parameters.

Please check if upgrading to 2.0.0 fixes that error. Thank you.