## TL;DR

Migrating TypeScript code from algoliasearch v4 to v5: algoliasearch(appId, apiKey).initIndex(indexName).getObjectsRecord no longer typechecks because initIndex is gone, and the v5 docs do not explain the new signatures.

## Steps

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

2. 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`.

## When to use

Use this skill when you run into "How to migrate initIndex / getObjects from algoliasearch v4 to v5".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

Migrating TypeScript code from algoliasearch v4 to v5: algoliasearch(appId, apiKey).initIndex(indexName).getObjectsRecord no longer typechecks because initIndex is gone, and the v5 docs do not explain the new signatures.
