serpapi-javascript icon indicating copy to clipboard operation
serpapi-javascript copied to clipboard

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

Open qwerq123456 opened this issue 2 years ago • 2 comments

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?

qwerq123456 avatar Jun 14 '23 02:06 qwerq123456

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

rolandtolnay avatar Jun 20 '23 12:06 rolandtolnay

@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.

zyc9012 avatar Jul 26 '23 05:07 zyc9012