Indice.updatedAt type mismatch

I have the following piece of Typescript code:

import {SearchClient, SearchIndex} from 'algoliasearch';
import {MultipleQueriesQuery, Indice} from '@algolia/client-search';

export async function indexLastUpdatedFor(adminClient: SearchClient, indexName: string): Promise<number> {
 const theIndex: Indice = await adminClient.listIndices()
     .then(res => {
       return res.items.filter(idx => {
       console.log(`Checking index ${JSON.stringify(idx)}`);
       return idx.name === indexName;
    })[0];
 });

 return theIndex.updatedAt;
}

I am using algoliasearch 4.8.2.

The type declaration for Indice in @algolia/client-search/dist/client-search.d.ts states Indice.updatedAt is a number.

However, when I run the above code, updatedAt is of type string not number and is the time in ISO format.

This is the same format as returned by the Search REST API: https://www.algolia.com/doc/api-reference/api-methods/list-indices/#json-format

What am I doing wrong?

Hi Mik,

This is indeed an error in the type definition of listIndices. A pull request to fix this has been made (https://github.com/algolia/algoliasearch-client-javascript/pull/1236), but in the mean time you can // @ts-ignore the error you retrieved when reading the data.

Thanks again for noticing this, and have a great day further!