Autocomplete - Cannot read properties of undefined

Hi all,

I’m fairly new to the world of Typescript, but I’ve been following documentation on how to setup autocomplete here Adding suggested searches | Autocomplete | Algolia, but no matter what I do, I’m always faced with this issue:

I’ve tried using import, but the example above was taken after I tried using require. I found out what when the nearest package.json must contain "type": "module" you could use require instead, which matches what I can see with the autocomplete package.json.

Both import and require result in the same error above, only the code slightly differs.

I’ve also tried using a ready made sandbox example, such as this one https://codesandbox.io/p/sandbox/github/algolia/autocomplete/tree/next/examples/query-suggestions-with-hits?file=%2Fapp.tsx. After getting rid of a few lines of code that threw errors, I see the same type of error message:

I’ve also tried returning a en empty div with the ID of autocomplete in conjunction with following the instructions from Adding suggested searches | Autocomplete | Algolia.

I also tried to modify the instant search functionality I got working, by replacing the search box with the autocomplete using these instructions Integrate Autocomplete with React InstantSearch | Autocomplete | Algolia, but they didn’t work, and resulted in the following error:

But neither of these have worked.

I’d appreciate any help anyone here can offer, and I look forward to hearing back.

Kind regards.

Adam