Skip to content

Types for search results are not working #212

@MickL

Description

@MickL

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions