Skip to content

Commit

Permalink
fix(member): useBoardList queryOptions 타입 추론 에러 (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwansikk committed Apr 9, 2024
1 parent f74f638 commit dd31e47
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
12 changes: 10 additions & 2 deletions apps/member/src/hooks/queries/useBoardsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ import { getNews } from '@api/news';
import { QUERY_KEY } from '@constants/key';
import { useSuspenseQuery } from '@tanstack/react-query';
import { getBoardsList } from '@api/board';
import { PaginationPramsType } from '@type/api';
import type { Pagination, PaginationPramsType } from '@type/api';
import type { CommunityCategoryType } from '@type/community';
import type { PostItem } from '@type/post';
import type { NewsItem } from '@type/news';
import type { HireItem } from '@type/hire';

interface QueryOptions {
queryKey: string;
queryFn: () => Promise<Pagination<PostItem | NewsItem | HireItem>>;
}

interface UseBoardsListParams extends PaginationPramsType {
category: CommunityCategoryType;
Expand All @@ -18,7 +26,7 @@ export const useBoardsList = ({
page = 0,
size = 6,
}: UseBoardsListParams) => {
const queryOptions = {
const queryOptions: QueryOptions = {
notice: {
queryKey: QUERY_KEY.BORDER_NOTICE,
queryFn: () => getBoardsList('notice', page, size),
Expand Down
2 changes: 1 addition & 1 deletion apps/member/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export interface BaseResponse<T = unknown> {
data: T;
}

interface Pagination<T = unknown> {
export interface Pagination<T = unknown> {
currentPage: number;
hasPrevious: boolean;
hasNext: boolean;
Expand Down
3 changes: 1 addition & 2 deletions apps/member/src/types/hire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export type EmploymentType =
| 'ASSISTANT'
| 'PART_TIME';

export interface HireItem
extends Omit<PostItem, 'writerName' | 'isOwner' | 'category'> {
export interface HireItem extends Omit<PostItem, 'isOwner' | 'category'> {
careerLevel: CareerLevel;
recruitmentPeriod: string;
jobPostingUrl: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/member/src/types/news.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PostItem } from './post';

export interface NewsItem extends Omit<PostItem, 'writerName'> {
export interface NewsItem extends PostItem {
articleUrl: string;
date: string;
source: string;
Expand Down

0 comments on commit dd31e47

Please sign in to comment.