--- id: wiki-2026-0508-과잉-속성-체크-epc title: 과잉 속성 체크(EPC) category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Excess Property Check, EPC, TypeScript 초과 속성 검사] duplicate_of: none source_trust_level: A confidence_score: 0.92 verification_status: applied tags: [typescript, type-system, structural-typing, frontend] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: TypeScript framework: tsc 5.x --- # 과잉 속성 체크(EPC) ## 매 한 줄 > **"매 object literal 을 매 직접 assign 할 때 매 declared shape 외 매 extra property 을 매 reject"**. TypeScript 의 매 structural typing 은 매 기본적으로 매 width subtype 을 매 허용하지만, 매 object literal 의 매 fresh literal type 은 매 EPC 라는 매 특수 검사 의 매 통과 의 필요. 매 2026 의 TS 5.x 의 매 동일 동작 의 유지, 매 satisfies / 매 as const 의 매 EPC 회피의 X. ## 매 핵심 ### 매 EPC 트리거 조건 - 매 fresh object literal (매 변수 의 매 binding X) - 매 declared type 의 매 존재 (매 parameter, 매 assignment target, 매 return) - 매 declared type 의 매 superset 의 X 인 매 property 의 매 포함 ### 매 EPC 우회 패턴 - 매 변수 의 매 intermediate binding (매 freshness 의 lose) - 매 type assertion (`as T`) — 매 권장 X - 매 index signature (`[k: string]: unknown`) ### 매 응용 1. 매 API option object 의 매 typo 방지. 2. 매 React props 의 매 unknown prop 차단. 3. 매 config schema 의 매 strict validation. ## 💻 패턴 ### EPC 발동 (기본) ```typescript interface ButtonProps { label: string; onClick: () => void; } function render(props: ButtonProps) {} // ❌ Error: Object literal may only specify known properties, and 'icon' does not exist in type 'ButtonProps' render({ label: "Save", onClick: () => {}, icon: "💾" }); ``` ### Intermediate binding 우회 (의도적이지 않은 경우 위험) ```typescript const extra = { label: "Save", onClick: () => {}, icon: "💾" }; render(extra); // ✅ 통과 — fresh 아니어서 EPC 미발동, structural width subtyping 만 검사 ``` ### satisfies 와 EPC ```typescript // satisfies 도 EPC 적용 — extra property reject const config = { label: "Save", onClick: () => {}, // icon: "💾", // ❌ EPC error } satisfies ButtonProps; ``` ### Index signature 로 의도적 허용 ```typescript interface FlexibleProps { label: string; [key: string]: unknown; } function render2(p: FlexibleProps) {} render2({ label: "Save", extra: 123 }); // ✅ ``` ### Discriminated union 과 EPC ```typescript type Action = | { type: "add"; value: number } | { type: "remove"; id: string }; function dispatch(a: Action) {} // ❌ EPC: 'value' 와 'id' 동시 존재 reject dispatch({ type: "add", value: 1, id: "x" }); ``` ### React props 에 적용 ```tsx type Props = { name: string }; function Hello(props: Props) { return
{props.name}
; } // ❌ EPC: 'age' is not in Props