fix: 프로젝트 전체 TypeScript 타입에러 408개 수정 (tsc --noEmit 0 errors)

- 공통 템플릿 타입 수정 (IntegratedDetailTemplate, UniversalListPage)
- 페이지(app/[locale]) 타입 호환성 수정 (80개)
- 재고/자재 모듈 타입 수정 (StockStatus, ReceivingManagement)
- 생산 모듈 타입 수정 (WorkOrders, WorkerScreen, WorkResults)
- 주문/출고 모듈 타입 수정 (ShipmentManagement, Orders)
- 견적/단가 모듈 타입 수정 (Quotes, Pricing)
- 건설 모듈 타입 수정 (49개, 17개 하위 모듈)
- HR 모듈 타입 수정 (CardManagement, VacationManagement 등)
- 설정 모듈 타입 수정 (PermissionManagement, AccountManagement 등)
- 게시판 모듈 타입 수정 (BoardManagement, BoardList 등)
- 회계 모듈 타입 수정 (VendorManagement, BadDebtCollection 등)
- 기타 모듈 타입 수정 (CEODashboard, clients, vehicle 등)
- 유틸/훅/API 타입 수정 (hooks, contexts, lib)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
유병철
2026-01-30 10:07:58 +09:00
parent 8a5cbde5ef
commit a1f4c82cec
154 changed files with 832 additions and 536 deletions

View File

@@ -28,15 +28,15 @@ import {
import { PageLayout } from '@/components/organisms/PageLayout';
import { PageHeader } from '@/components/organisms/PageHeader';
import { toast } from 'sonner';
import type { Account, AccountFormData, AccountStatus } from './types';
import type { Account, AccountFormData, AccountStatus } from '../types';
import {
BANK_OPTIONS,
BANK_LABELS,
ACCOUNT_STATUS_OPTIONS,
ACCOUNT_STATUS_LABELS,
ACCOUNT_STATUS_COLORS,
} from './types';
import { createBankAccount, updateBankAccount, deleteBankAccount } from './actions';
} from '../types';
import { createBankAccount, updateBankAccount, deleteBankAccount } from '../actions';
interface AccountDetailProps {
account?: Account;
@@ -73,7 +73,7 @@ export function AccountDetail({ account, mode: initialMode }: AccountDetailProps
const isEditMode = mode === 'edit';
const handleChange = (field: keyof AccountFormData, value: string) => {
setFormData(prev => ({ ...prev, [field]: value }));
setFormData((prev: AccountFormData) => ({ ...prev, [field]: value }));
};
const handleBack = () => {

View File

@@ -194,7 +194,7 @@ function transformFrontendToApi(
): Record<string, unknown> {
// 로고 URL에서 상대 경로 추출 (API는 상대 경로 기대)
let logoPath: string | null = null;
if (data.companyLogo) {
if (data.companyLogo && typeof data.companyLogo === 'string') {
const apiUrl = process.env.NEXT_PUBLIC_API_URL || '';
logoPath = data.companyLogo.startsWith(apiUrl)
? data.companyLogo.replace(apiUrl, '')

View File

@@ -105,7 +105,7 @@ export function ItemSettingsDialog({ isOpen, onClose, settings, onSave }: ItemSe
return {
...prev,
[category]: updatedCategory as typeof categorySettings,
[category]: updatedCategory as unknown as typeof categorySettings,
};
});
}, []);

View File

@@ -166,5 +166,5 @@ function transformApiToFrontend(apiData: Record<string, unknown>): NotificationS
function transformFrontendToApi(settings: NotificationSettings): Record<string, unknown> {
// 프론트엔드 형식이 이미 API 형식과 동일하다고 가정
// 필요시 camelCase → snake_case 변환
return settings as Record<string, unknown>;
return settings as unknown as Record<string, unknown>;
}

View File

@@ -286,73 +286,8 @@ export function PermissionDetail({ permission, onBack, onSave, onDelete }: Permi
return { success: true };
}, []);
// 폼 콘텐츠 렌더링
const renderFormContent = useCallback(() => (
<div className="space-y-6">
{/* 기본 정보 */}
<Card>
<CardContent className="p-6">
<h3 className="text-lg font-semibold mb-4"> </h3>
<div className="grid grid-cols-2 gap-6">
<div className="space-y-2">
<Label htmlFor="perm-name"></Label>
<Input
id="perm-name"
value={name}
onChange={(e) => handleNameChange(e.target.value)}
onBlur={handleNameBlur}
/>
</div>
<div className="space-y-2">
<Label htmlFor="perm-status"></Label>
<Select value={status} onValueChange={handleStatusChange}>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="active"></SelectItem>
<SelectItem value="hidden"></SelectItem>
</SelectContent>
</Select>
</div>
</div>
</CardContent>
</Card>
{/* 메뉴별 권한 설정 테이블 */}
<Card>
<CardContent className="p-6">
<h3 className="text-lg font-semibold mb-4"></h3>
<div className="overflow-x-auto">
<Table>
<TableHeader>
<TableRow className="border-b">
<TableHead className="w-64 py-4"></TableHead>
{PERMISSION_TYPES.map(pt => (
<TableHead key={pt} className="text-center w-24 py-4">
<div className="flex flex-col items-center gap-2">
<span className="text-sm font-medium">{PERMISSION_LABELS_MAP[pt]}</span>
<Checkbox
checked={menuPermissions.length > 0 && menuPermissions.every(mp => mp.permissions[pt])}
onCheckedChange={(checked) => handleColumnSelectAll(pt, !!checked)}
/>
</div>
</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{renderMenuRows()}
</TableBody>
</Table>
</div>
</CardContent>
</Card>
</div>
), [name, status, menuPermissions, handleNameChange, handleNameBlur, handleStatusChange, handleColumnSelectAll, renderMenuRows]);
// 메뉴 행 렌더링 (재귀적으로 부모-자식 처리)
const renderMenuRows = () => {
const renderMenuRows = useCallback(() => {
const rows: React.ReactElement[] = [];
menuStructure.forEach(menu => {
@@ -419,16 +354,81 @@ export function PermissionDetail({ permission, onBack, onSave, onDelete }: Permi
});
return rows;
};
}, [menuStructure, menuPermissions, expandedMenus, toggleMenuExpand, handlePermissionToggle]);
// 폼 콘텐츠 렌더링
const renderFormContent = useCallback(() => (
<div className="space-y-6">
{/* 기본 정보 */}
<Card>
<CardContent className="p-6">
<h3 className="text-lg font-semibold mb-4"> </h3>
<div className="grid grid-cols-2 gap-6">
<div className="space-y-2">
<Label htmlFor="perm-name"></Label>
<Input
id="perm-name"
value={name}
onChange={(e) => handleNameChange(e.target.value)}
onBlur={handleNameBlur}
/>
</div>
<div className="space-y-2">
<Label htmlFor="perm-status"></Label>
<Select value={status} onValueChange={handleStatusChange}>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="active"></SelectItem>
<SelectItem value="hidden"></SelectItem>
</SelectContent>
</Select>
</div>
</div>
</CardContent>
</Card>
{/* 메뉴별 권한 설정 테이블 */}
<Card>
<CardContent className="p-6">
<h3 className="text-lg font-semibold mb-4"></h3>
<div className="overflow-x-auto">
<Table>
<TableHeader>
<TableRow className="border-b">
<TableHead className="w-64 py-4"></TableHead>
{PERMISSION_TYPES.map(pt => (
<TableHead key={pt} className="text-center w-24 py-4">
<div className="flex flex-col items-center gap-2">
<span className="text-sm font-medium">{PERMISSION_LABELS_MAP[pt]}</span>
<Checkbox
checked={menuPermissions.length > 0 && menuPermissions.every(mp => mp.permissions[pt])}
onCheckedChange={(checked) => handleColumnSelectAll(pt, !!checked)}
/>
</div>
</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{renderMenuRows()}
</TableBody>
</Table>
</div>
</CardContent>
</Card>
</div>
), [name, status, menuPermissions, handleNameChange, handleNameBlur, handleStatusChange, handleColumnSelectAll, renderMenuRows]);
return (
<>
<IntegratedDetailTemplate
config={permissionConfig}
mode="view"
initialData={permission}
initialData={permission as unknown as Record<string, unknown>}
itemId={permission.id}
onBack={onBack}
onCancel={onBack}
onDelete={handleFormDelete}
renderView={() => renderFormContent()}
renderForm={() => renderFormContent()}

View File

@@ -24,6 +24,8 @@ import {
type TableColumn,
type StatCard,
type TabOption,
type SelectionHandlers,
type RowClickHandlers,
} from '@/components/templates/UniversalListPage';
import { ListMobileCard, InfoField } from '@/components/organisms/MobileCard';
import { DeleteConfirmDialog } from '@/components/ui/confirm-dialog';
@@ -262,7 +264,7 @@ export function PermissionManagement() {
item: Role,
index: number,
globalIndex: number,
handlers: { isSelected: boolean; onToggle: () => void; onRowClick?: () => void }
handlers: SelectionHandlers & RowClickHandlers<Role>
) => {
const { isSelected, onToggle } = handlers;
const hasSelection = selectedItems.size > 0;
@@ -332,7 +334,7 @@ export function PermissionManagement() {
item: Role,
index: number,
globalIndex: number,
handlers: { isSelected: boolean; onToggle: () => void; onRowClick?: () => void }
handlers: SelectionHandlers & RowClickHandlers<Role>
) => {
const { isSelected, onToggle } = handlers;
return (
@@ -498,24 +500,18 @@ export function PermissionManagement() {
return newSet;
});
},
onToggleSelectAll: (ids: string[]) => {
onToggleSelectAll: () => {
setSelectedItems(prev => {
if (prev.size === ids.length) {
if (prev.size > 0) {
return new Set();
}
return new Set(ids);
return new Set(roles.map(r => String(r.id)));
});
},
getItemId: (item: Role) => item.id,
}}
externalTab={{
activeTab,
setActiveTab,
}}
externalSearch={{
searchValue: searchQuery,
setSearchValue: setSearchQuery,
getItemId: (item: Role) => String(item.id),
}}
onTabChange={setActiveTab}
onSearchChange={setSearchQuery}
externalIsLoading={isLoading}
/>
);

View File

@@ -186,7 +186,7 @@ export function PopupDetailClientV2({ popupId, initialMode }: PopupDetailClientV
<IntegratedDetailTemplate
config={dynamicConfig}
mode={mode}
initialData={initialData}
initialData={initialData as Record<string, unknown> | undefined}
itemId={popupId}
isLoading={isLoading}
onSubmit={handleSubmit}

View File

@@ -34,6 +34,7 @@ import {
CardTitle,
} from '@/components/ui/card';
import { RichTextEditor } from '@/components/board/RichTextEditor';
import { isNextRedirectError } from '@/lib/utils/redirect-error';
import {
type Popup,
type PopupTarget,

View File

@@ -166,7 +166,7 @@ export function SubscriptionClient({ initialData }: SubscriptionClientProps) {
<div className="flex items-center justify-between mb-2">
<div className="text-sm text-muted-foreground"> </div>
<Badge variant={subscription.status === 'active' ? 'default' : 'secondary'}>
{SUBSCRIPTION_STATUS_LABELS[subscription.status] || subscription.status}
{(subscription.status && SUBSCRIPTION_STATUS_LABELS[subscription.status]) || subscription.status}
</Badge>
</div>