refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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