Algolia search with TypeScript
A small post about gotchas when using Algolia search with TypeScript.
Algolia is great hosted search engine service. It's very easy to get up and running with and comes with a generous dev tier. It provides a wide array of SDKs to integrate with your codebase.
We gonna talk about their JavaScript based UI SDKs, namely instantsearch-js
and react-instantsearch
. Both of these can be installed via a package manager like npm, pnpm or yarn.
They both come with built in types, that you may have figured out if you stumbled upon one of their rare documentations with TypeScript snippets, but generally, you have to be pretty savvy with TypeScript and examine the type signatures yourself to figure out how to use them.
On top of this, they have different types for returning the same hit
whether you got it from their node
client or react
. Truly mind boggling sometimes.
This makes them not so beginner friendly.
Photo by Jametlene Reskp on Unsplash