algolia icon indicating copy to clipboard operation
algolia copied to clipboard

Types for search results are not working

Open MickL opened this issue 1 year ago • 2 comments

When following the docs, the auto completion for the index name works, but result.value.hits is not typed:

import '@nuxtjs/algolia'

declare module '@nuxtjs/algolia' {
  interface AlgoliaIndices {
    someIndex: {
      foo: string;
      bar: number;
    }
  }
<script lang="ts" setup>
   const { result, search } = useAlgoliaSearch('someIndex') // <-- Auto-completion works
   await search({ query: 'test' }) 

   result.value.hits[0].bar = '1'; // <-- TS Error
</script>

Image

MickL avatar Nov 26 '24 23:11 MickL