algolia / algoliasearch-client-javascript

⚡️ A fully-featured and blazing-fast JavaScript API client to interact with Algolia.
https://www.algolia.com/doc/api-client/javascript/getting-started/
MIT License
1.33k stars 222 forks source link

[v5] HighlightResult and SnippetResult doesn't support nested structure #1534

Closed NeoJRotary closed 3 months ago

NeoJRotary commented 3 months ago

version: 5.0.0-beta.16

Current HighlightResult only has single layer or extra one layer of Record<>.

https://github.com/algolia/algoliasearch-client-javascript/blob/5c1a7003e4052033048d6f1687cc6eb384b75264/packages/client-search/model/highlightResult.ts#L5-L8

v4 type accepts THit and recursive call itself for nested structure.

https://github.com/algolia/algoliasearch-client-javascript/blob/99ebe3c8dcea748077a26fb0eb680ffea06af5ab/packages/client-search/src/types/Hit.ts#L8-L12

shortcuts commented 3 months ago

thanks @NeoJRotary for using the beta client and reporting the issue! we have an ongoing fix in https://github.com/algolia/api-clients-automation/pull/3497 which should make the typing better (still not as precise as v4, but that's a bit complicated with code generation on every clients)

I'll let you know once released!