Skip to content

Commit a0228e4

Browse files
authored
fix(types): correct type for SearchClient (#1195)
in some cases this was inferred to `any` instead of the right type, after TS 5.1.3. This fix was also done in the helper: algolia/algoliasearch-helper-js#943 this would have been caught if it was moved in the JS monorepo so the code could be in a shared package, or if we had updated to TS 5.1.3
1 parent a76b914 commit a0228e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/autocomplete-shared/src/preset-algolia/algoliasearch.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import * as ClientSearch from '@algolia/client-search';
22
import type * as AlgoliaSearch from 'algoliasearch/lite';
33

44
// turns any to unknown, so it can be used as a conditional
5-
type AnyToUnknown<TSubject> = (any extends TSubject ? true : false) extends true
5+
// https://github.com/algolia/instantsearch/blob/18959b47f2f541f410e091a0cb7140f40e0956c2/packages/algoliasearch-helper/types/algoliasearch.d.ts#L14-L18
6+
type AnyToUnknown<TSubject> = (
7+
0 extends 1 & TSubject ? true : false
8+
) extends true
69
? unknown
710
: TSubject;
811

0 commit comments

Comments
 (0)