Skip to content

Commit

Permalink
Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
widoz committed Apr 6, 2024
1 parent 1a1230f commit a9f53e6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sources/client/src/components/preset-post-types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { createHigherOrderComponent } from '@wordpress/compose';
type EntitiesValue = EntitiesSearch.Value;
type Entities = EntitiesSearch.Entities< EntitiesValue >;
type KindValue = EntitiesSearch.Kind< string > | string;
type PostFinder = typeof searchPosts;
type PostsFinder = typeof searchPosts;

type EntitiesComponent = React.ComponentType<
EntitiesSearch.BaseControl< EntitiesValue >
Expand All @@ -45,7 +45,7 @@ interface InternalComponent
EntitiesSearch.CompositeEntitiesKinds< EntitiesValue, string >,
'kind' | 'entities'
> {
searchPosts: PostFinder;
searchPosts: PostsFinder;
kindComponent: KindComponent;
entitiesComponent: EntitiesComponent;
}
Expand Down Expand Up @@ -86,7 +86,7 @@ const withDataBound = createHigherOrderComponent<
onChange: props.onChangeKind,
};

const _searchPosts = postFinderWithExtraFields(
const _searchPosts = postsFinderWithExtraFields(
searchPosts,
props.entitiesFields
);
Expand All @@ -104,16 +104,16 @@ const withDataBound = createHigherOrderComponent<
'withDataBound'
);

function postFinderWithExtraFields(
postFinder: PostFinder,
function postsFinderWithExtraFields(
postsFinder: PostsFinder,
entitiesFields?: EntitiesSearch.QueryArguments[ 'fields' ]
): PostFinder {
): PostsFinder {
return (
phrase: string,
postTypes: EntitiesSearch.Kind< string >,
queryArguments?: EntitiesSearch.QueryArguments
) =>
postFinder( phrase, postTypes, {
postsFinder( phrase, postTypes, {
...queryArguments,
fields: [
...( queryArguments?.fields ?? [ 'title', 'id' ] ),
Expand Down

0 comments on commit a9f53e6

Please sign in to comment.