Skip to content

Commit

Permalink
fix(types): correct type for SearchClient (#1195)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Haroenv committed Oct 2, 2023
1 parent a76b914 commit a0228e4
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -2,7 +2,10 @@ import * as ClientSearch from '@algolia/client-search';
import type * as AlgoliaSearch from 'algoliasearch/lite';

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

Expand Down

0 comments on commit a0228e4

Please sign in to comment.