34 lines
1.5 KiB
Markdown
34 lines
1.5 KiB
Markdown
---
|
|
id: wiki-2026-0508-타입스크립트-상태-관리-및-분기-처리-설계
|
|
title: 타입스크립트 상태 관리 및 분기 처리 설계
|
|
category: 10_Wiki/Topics
|
|
status: duplicate
|
|
canonical_id: type-safe-error-handling-exhaustiveness-checking
|
|
duplicate_of: "[[Type-safe Error Handling Exhaustiveness Checking]]"
|
|
aliases: [Discriminated Union State, TS State Machine]
|
|
source_trust_level: A
|
|
confidence_score: 0.9
|
|
verification_status: redirected
|
|
tags: [duplicate, typescript, state-management, discriminated-union]
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
---
|
|
|
|
# 타입스크립트 상태 관리 및 분기 처리 설계
|
|
|
|
> **이 문서는 [[Type-safe Error Handling Exhaustiveness Checking]] 의 중복본입니다.** Canonical 문서로 redirect.
|
|
|
|
## 핵심 요약 (specialization)
|
|
- TS 상태 모델링: `type State = { kind: 'idle' } | { kind: 'loading' } | { kind: 'success', data: T } | { kind: 'error', err: E }` — discriminated union 으로 모든 분기 *exhaustiveness* 보장.
|
|
- `switch (s.kind)` + `default: const _: never = s` 패턴 — 새로운 state 추가 시 compile error 로 모든 분기 강제 갱신.
|
|
|
|
## 🔗 Graph
|
|
- 부모: [[Type-safe Error Handling Exhaustiveness Checking]] (canonical)
|
|
- 인접: [[never 타입(never type)]] · [[Encapsulation-via-Access-Modifiers]] · [[리터럴 타입 (Literal Types)]]
|
|
|
|
## 🕓 변경 이력
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | 중복 처리 — canonical 문서로 redirect |
|