Migrating TypeScript code from algoliasearch v4 to v5: algoliasearch(appId, apiKey).initIndex(indexName).getObjects[Record](ids) no longer typechecks because initIndex is gone, and the v5 docs do not explain the new signatures. The generated typings are hard to read, react-instantsearch's [Configure] props like hitsPerPage and analyticsTags reference v5 types that do not include them, and several related method signatures changed shape in undocumented ways. The reporter also flagged that the v5 upgrade guide did not document the signature changes, so migration required reading the generated source.
How to migrate initIndex / getObjects from algoliasearch v4 to v5
There is no initIndex replacement in v5: every method is available at the root of the client, and methods that were called on an index now take indexName as a parameter, e.g. algoliasearch(appId, apiKey).getObjects[AlgoliaRecord]({ requests: [{ indexName: productsAlgoliaIndex, objectID: productId }] }). The v5 upgrade guide documents the initIndex removal. If you use react-instantsearch, make sure you are on the very latest version (the Configure prop types were being fixed alongside this report); older versions misinfer the v5 types. Community migration notes cover other signature changes, e.g. browseObjects now takes an aggregator function receiving { hits }, and setSettings nests settings under indexSettings. Source: https://github.com/algolia/algoliasearch-client-javascript/issues/1537
Source: https://github.com/algolia/algoliasearch-client-javascript/issues/1537