Skip to content

Commit

Permalink
refactor: useCheckbox, useRadio 관련 컴포넌트 및 훅 타입 강제 변경
Browse files Browse the repository at this point in the history
내부로직상 id와 name 프로퍼티 모두 필요하므로 해당 프로퍼티들을 강제하되 다른 프로퍼티가 올 수 있도록 열어둔다.
  • Loading branch information
semnil5202 committed Apr 17, 2024
1 parent cb308b0 commit a7e6fdf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/components/CheckboxContainer/CheckboxContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import Flex from '../Flex/Flex';
import Text from '../Text/Text';

interface CheckboxOptions {
checked: boolean;
id: number;
name: string;
checked: boolean;
[key: string]: any;
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/RadioContainer/RadioContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import Text from '../Text/Text';
type GapType = 'small' | 'large';

interface RadioOptions {
checked: boolean;
id: number;
name: string;
checked: boolean;
[key: string]: any;
}
interface Props<T> {
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useCheckbox.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ChangeEvent, useCallback, useState } from 'react';

interface CheckboxItem {
checked: boolean;
id: number;
name: string;
checked: boolean;
[key: string]: any;
}

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useRadio.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ChangeEvent, useCallback, useState } from 'react';

interface RadioItem {
checked: boolean;
id: number;
name: string;
checked: boolean;
[key: string]: any;
}

Expand Down

0 comments on commit a7e6fdf

Please sign in to comment.