This expression is not callable. Type 'typeof import("...../node_modules/algoliasearch/index")' has no call signatures.ts(2349)

Hello,

I wanted to start the integration and implementation of algolia into my app and get this error after installing algoliasearch and trying to initialize a client’

This expression is not callable. Type ‘typeof import("…/node_modules/algoliasearch/index")’ has no call signatures.ts(2349)

const algoliasearch = require('algoliasearch');

const client = algoliasearch(
  process.env.ALGOLIA_APP_ID,
  process.env.ALGOLIA_API_KEY,
);

Best,

Could you make a GitHub setup with what typescript version you are using etc? The code is correct in theory

I’m not using typescript, im using nodejs and its working but somehow I need to import it like

import algoliasearch from ‘algoliasearch’;

do I use a wrong library or how to require the algoliasearch library?

That should work, can you create a reproduction somewhere?

yes it works, it gives actually a linting error: https://github.com/benmosher/eslint-plugin-import/blob/v2.22.0/docs/rules/no-unresolved.md

this linting warning happens when you don’t add the dependency. If it works that you should eslint-disable the warning