Skip to content

Commit

Permalink
Cleanup function definition
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding committed May 9, 2024
1 parent 1d74518 commit 0e10348
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/features/feed/sort/useFeedSort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import {
setFeedSort,
} from "./feedSortSlice";

type SortTypeByContext = {
posts: SortType;
comments: CommentSortType;
};
export default function useSortByFeed<Context extends "posts" | "comments">(
context: Context,
feed?: FeedSortFeed | undefined,
) {
type Sort = {
posts: SortType;
comments: CommentSortType;
}[Context];

export default function useSortByFeed<
Context extends "posts" | "comments",
Sort extends SortTypeByContext[Context],
>(context: Context, feed?: FeedSortFeed | undefined) {
const dispatch = useAppDispatch();
const feedSort = useAppSelector(
getFeedSortSelectorBuilder(feed, context),
Expand Down

0 comments on commit 0e10348

Please sign in to comment.