Skip to content

Commit

Permalink
fix(preset-algolia): ensure "ts-ignore" is present in the output (#1035)
Browse files Browse the repository at this point in the history
There's no real way to enforce this, but /** comments get preserved in the output, but // comments don't. This is typescript behaviour that's not well documented: microsoft/TypeScript#37144
  • Loading branch information
Haroenv authored Oct 28, 2022
1 parent 6cd9fd7 commit c8a0f68
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/autocomplete-preset-algolia/src/types/algoliasearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ type SearchClientShape = {
};

type ClientLiteV5 = AnyToUnknown<
// @ts-ignore
/** @ts-ignore */
ReturnType<typeof AlgoliaSearch.liteClient>
>;
type ClientSearchV5 = AnyToUnknown<
// @ts-ignore
/** @ts-ignore */
ReturnType<typeof ClientSearch.searchClient>
>;
type ClientV5 = ClientLiteV5 extends SearchClientShape
Expand All @@ -29,43 +29,43 @@ type PickForClient<
> = ClientV5 extends SearchClientShape ? TMapping['v5'] : TMapping['v4'];

export type SearchClient = PickForClient<{
// @ts-ignore
/** @ts-ignore */
v4: AlgoliaSearch.SearchClient;
// @ts-ignore
/** @ts-ignore */
v5: ClientV5;
}>;

export type MultipleQueriesQuery = PickForClient<{
// @ts-ignore
/** @ts-ignore */
v4: ClientSearch.MultipleQueriesQuery;
// @ts-ignore
/** @ts-ignore */
v5: AlgoliaSearch.LegacySearchMethodProps[number];
}>;

export type SearchForFacetValuesResponse = PickForClient<{
// @ts-ignore
/** @ts-ignore */
v4: ClientSearch.SearchForFacetValuesResponse;
// @ts-ignore
/** @ts-ignore */
v5: AlgoliaSearch.SearchForFacetValuesResponse;
}>;

export type SearchResponse<THit> = PickForClient<{
// @ts-ignore
/** @ts-ignore */
v4: ClientSearch.SearchResponse<THit>;
// @ts-ignore
/** @ts-ignore */
v5: AlgoliaSearch.SearchResponse<THit>;
}>;

export type HighlightResult<THit> = PickForClient<{
// @ts-ignore
/** @ts-ignore */
v4: ClientSearch.HighlightResult<THit>;
// @ts-ignore
/** @ts-ignore */
v5: AlgoliaSearch.HighlightResult; // should be generic, but isn't yet in the client
}>;

export type SnippetResult<THit> = PickForClient<{
// @ts-ignore
/** @ts-ignore */
v4: ClientSearch.SnippetResult<THit>;
// @ts-ignore
/** @ts-ignore */
v5: AlgoliaSearch.SnippetResult; // should be generic, but isn't yet in the client
}>;

0 comments on commit c8a0f68

Please sign in to comment.