Skip to content

Commit

Permalink
suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed Feb 9, 2023
1 parent d1e09d3 commit d5f8fc3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/autocomplete-core/src/types/AutocompleteSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export type OnResolveParams<TItem extends BaseItem> = {
state: AutocompleteState<TItem>;
};

type DefaultIndicator = { __default?: boolean };
type DefaultIndicator = {
/**
* Optional key on a function to indicate it's the default value of this function.
*/
__default?: boolean;
};

export interface AutocompleteSource<TItem extends BaseItem> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ export function createRedirectUrlPlugin<TItem extends BaseItem>(
if (source.getItemInputValue!.__default) {
warn(
false,
`The source ${source.sourceId} does not have a \`getItemInputValue\` function. It's required to be able to filter out the redirect item.` +
`The source ${JSON.stringify(
source.sourceId
)} does not have a \`getItemInputValue\` function. It's required to be able to filter out the redirect item.` +
'\nSee https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getiteminputvalue'
);
return true;
Expand All @@ -133,7 +135,9 @@ export function createRedirectUrlPlugin<TItem extends BaseItem>(
if (itemInputValue === undefined) {
warn(
false,
`The source ${source.sourceId} does not return a string from the \`getItemInputValue\` function. It's required to be able to filter out the redirect item.` +
`The source ${JSON.stringify(
source.sourceId
)} does not return a string from the \`getItemInputValue\` function. It's required to be able to filter out the redirect item.` +
'\nSee https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getiteminputvalue'
);
return true;
Expand Down

0 comments on commit d5f8fc3

Please sign in to comment.