Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): make algoliasearch detection compatible with TS 5.4.5 #6244

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions packages/algoliasearch-helper/types/algoliasearch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,24 @@ type SearchClientShape = {
// @ts-ignore
type ClientV3_4 = ReturnType<typeof algoliasearch>;

type ClientLiteV5 = AnyToUnknown<
// @ts-ignore
ReturnType<typeof AlgoliaSearchLite.liteClient>
>;
type ClientFullV5 = AnyToUnknown<
// @ts-ignore
ReturnType<typeof AlgoliaSearch.algoliasearch>
>;
type ClientSearchV5 = AnyToUnknown<
// @ts-ignore
ReturnType<typeof ClientSearch.searchClient>
>;
type ClientLiteV5 = AnyToUnknown<typeof AlgoliaSearchLite> extends unknown
? unknown
: AnyToUnknown<
// @ts-ignore
ReturnType<typeof AlgoliaSearchLite.liteClient>
>;
type ClientFullV5 = AnyToUnknown<typeof AlgoliaSearch> extends unknown
? unknown
: AnyToUnknown<
// @ts-ignore
ReturnType<typeof AlgoliaSearch.algoliasearch>
>;
type ClientSearchV5 = AnyToUnknown<typeof ClientSearch> extends unknown
? unknown
: AnyToUnknown<
// @ts-ignore
ReturnType<typeof ClientSearch.searchClient>
>;
type ClientV5 = ClientLiteV5 extends SearchClientShape
? ClientLiteV5
: ClientSearchV5 extends SearchClientShape
Expand Down