docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
---
|
||||
id: wiki-2026-0508-excess-property-checking
|
||||
title: Excess Property Checking
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [TypeScript Excess Property, Strict Object Literal]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [typescript, type-system, structural-typing]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: typescript
|
||||
framework: none
|
||||
---
|
||||
|
||||
# Excess Property Checking
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 fresh object literal 의 only 의 strict property check"**. TypeScript 매 structural typing 매 normally 의 extra properties 의 allow, 매 but 의 fresh object literal 의 directly 의 typed slot 의 assign 시 매 extra properties 의 error 의 raise. Typo 방지 + intent clarity 의 design choice.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 Why exists
|
||||
- 매 structural typing 매 `{a:1, b:2}` 의 `{a:number}` 의 assignable.
|
||||
- 매 그러나 매 literal 매 typo 의 high risk — `{ colour: 'red' }` 매 `{ color?: string }` 매 silent ignore.
|
||||
- 매 TS 매 fresh literal 의 special-case — 매 `Object literal may only specify known properties` 의 error.
|
||||
|
||||
### 매 Fresh-ness 매 lost
|
||||
- 매 variable 의 assign 시 매 widened — `const x = { extra: 1 }; fn(x)` 매 ok.
|
||||
- 매 spread 매 fresh-ness 의 keep (TS 4.0+).
|
||||
- 매 type assertion `as T` 매 bypass.
|
||||
- 매 index signature `[k: string]: ...` 매 disable.
|
||||
|
||||
### 매 응용
|
||||
1. React props typo detection.
|
||||
2. Config object validation.
|
||||
3. API request body shape enforcement.
|
||||
4. Discriminated union narrowing aid.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Basic excess error
|
||||
```typescript
|
||||
interface Point { x: number; y: number }
|
||||
const p: Point = { x: 1, y: 2, z: 3 };
|
||||
// ^^^^ Object literal may only specify known properties
|
||||
```
|
||||
|
||||
### Bypass via intermediate variable
|
||||
```typescript
|
||||
const tmp = { x: 1, y: 2, z: 3 };
|
||||
const p: Point = tmp; // OK — fresh-ness lost
|
||||
// Use this only when extra properties are intentional
|
||||
```
|
||||
|
||||
### Index signature 의 opt-out
|
||||
```typescript
|
||||
interface Config {
|
||||
name: string;
|
||||
[key: string]: unknown; // 매 extra props 의 allow
|
||||
}
|
||||
const c: Config = { name: 'x', debug: true, port: 3000 }; // OK
|
||||
```
|
||||
|
||||
### React props 의 typo guard
|
||||
```typescript
|
||||
type ButtonProps = { label: string; onClick: () => void };
|
||||
function Button(props: ButtonProps) { /* ... */ }
|
||||
|
||||
<Button label="Save" onCick={save} />
|
||||
// ^^^^^ Property 'onCick' does not exist
|
||||
// Excess property check catches typo at JSX call site
|
||||
```
|
||||
|
||||
### Discriminated union with strict checks
|
||||
```typescript
|
||||
type Shape =
|
||||
| { kind: 'circle'; radius: number }
|
||||
| { kind: 'square'; side: number };
|
||||
|
||||
const s: Shape = { kind: 'circle', radius: 5, side: 3 };
|
||||
// ^^^^ excess
|
||||
// 매 kind 의 narrow 의 'circle', 매 side 의 not allowed
|
||||
```
|
||||
|
||||
### Spread 의 preserve fresh-ness (TS 4.0+)
|
||||
```typescript
|
||||
type T = { a: number };
|
||||
const base = { a: 1 };
|
||||
const x: T = { ...base, b: 2 }; // 매 error — b 의 excess
|
||||
```
|
||||
|
||||
### Optional excess via Exact type emulation
|
||||
```typescript
|
||||
type Exact<T, U extends T> = T & {
|
||||
[K in Exclude<keyof U, keyof T>]: never;
|
||||
};
|
||||
|
||||
function strict<T>() {
|
||||
return <U extends T>(x: Exact<T, U>): T => x as T;
|
||||
}
|
||||
|
||||
const point = strict<Point>()({ x: 1, y: 2, z: 3 });
|
||||
// ^^^^ Type 'number' is not assignable to 'never'
|
||||
// 매 variable assign path 의 also 의 strict
|
||||
```
|
||||
|
||||
### Util: 매 satisfies operator (TS 4.9+)
|
||||
```typescript
|
||||
const config = {
|
||||
endpoint: 'https://api.example.com',
|
||||
timeout: 5000,
|
||||
retries: 3,
|
||||
} satisfies { endpoint: string; timeout: number };
|
||||
// ^^^^ 매 retries 의 excess error
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Config / DTO literal | 매 default check 의 leverage |
|
||||
| Plugin system 의 unknown extras | 매 index signature 의 add |
|
||||
| Test fixture 의 extra debug fields | 매 intermediate var 또는 `as` |
|
||||
| 매 strict 의 want 의 variable path | 매 `Exact` helper 또는 `satisfies` |
|
||||
| Library author 의 strict API | 매 `satisfies` 또는 nominal brand |
|
||||
|
||||
**기본값**: 매 default behavior 의 leverage — 매 typo 매 catch. 매 escape 매 minimize, 매 `satisfies` 의 prefer.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[TypeScript]] · [[TypeScript 타입 시스템 (TypeScript Type System)|Type-System]]
|
||||
- 변형: [[Structural Typing|Structural-Typing]] · [[Satisfies Operator]]
|
||||
- Adjacent: [[API Response & State Modeling|Discriminated-Unions]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 typo-prone literal — config, props, API body. Schema-bound inputs.
|
||||
**언제 X**: 매 plugin / metadata 의 extra props 매 intentional — 매 index signature 의 add.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **`as T` 의 bypass habit**: 매 error 의 mask, 매 typo 의 ship — 매 fix 의 root cause.
|
||||
- **Index signature 의 over-permissive**: 매 모든 class 매 `[k: string]: any` 의 add — 매 type safety 의 destroy.
|
||||
- **Intermediate var 의 escape**: 매 `const x = {...}; fn(x)` 매 intent 의 obscure — 매 명시적 cast 의 prefer.
|
||||
- **`satisfies` 의 ignore**: 매 TS 4.9+ 매 widening 없는 strict literal 의 best tool — 매 underused.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (TS handbook "Object Types"; TS 4.9 release notes).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — excess property check + satisfies/Exact patterns |
|
||||
Reference in New Issue
Block a user