--- id: wiki-2026-0508-초과-속성-검사-excess-property-checks title: 초과 속성 검사 (Excess Property Checks) category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Excess Property Checks, EPC] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [typescript, type-system, frontend] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: typescript framework: tsc --- # 초과 속성 검사 (Excess Property Checks) ## 매 한 줄 > **"매 object literal 의 typo 잡는 TypeScript 의 strictness gate"**. 매 object literal 을 직접 assign / pass 할 때, target type 에 없는 property 가 있으면 error. 매 typo prevention 의 first line of defense — 그러나 매 변수 indirection 으로 우회 가능. ## 매 핵심 ### 매 trigger 조건 - 매 object **literal** 만 적용 — `{ ... }` 직접 assign / argument pass / return. - 매 변수 binding 후 pass 하면 EPC X (structural subtyping 만 적용). - 매 type assertion (`as Foo`) 시 EPC X. ### 매 왜 존재 - 매 typo (`color` vs `colour`) 같은 silent bug 방지. - 매 structural typing 의 hole 메우기 — 매 extra property 는 logically unintended. ### 매 응용 1. Component props 의 typo 방지. 2. API request body 의 unintended field 방지. 3. Config object 의 unknown key 방지. ## 💻 패턴 ### 1. Basic EPC trigger ```typescript interface Square { color: string; width: number; } function createSquare(s: Square) { /* ... */ } // Error: 'colour' does not exist in type 'Square' createSquare({ colour: 'red', width: 100 }); // OK — 매 변수 indirection bypass const sq = { colour: 'red', width: 100 }; createSquare(sq); // structural — passes ``` ### 2. Index signature escape hatch ```typescript interface SquareConfig { color?: string; width?: number; [propName: string]: unknown; // 매 extra property 허용 } createSquare({ color: 'red', width: 100, foo: 'bar' }); // OK ``` ### 3. Type assertion bypass ```typescript createSquare({ colour: 'red', width: 100 } as Square); // EPC suppressed (위험) ``` ### 4. Spread bypass ```typescript const extras = { foo: 'bar' }; createSquare({ color: 'red', width: 100, ...extras }); // OK — spread bypasses EPC ``` ### 5. React props 의 typo 방지 ```tsx interface ButtonProps { variant: 'primary' | 'secondary'; } function Button(p: ButtonProps) { return ; } // Error: 'varient' does not exist on type 'ButtonProps'