"에디터에서 파일들 열어. 패턴이 거기 그대로 있어. 야생에서 알아보는 게 테스트."
레시피로서의 route
이 투어가 어떤 Pippa-style TypeScript frontend 든 — 너의 자기 프로젝트, open-source 앱, 또는 어떤 well-typed React codebase — 에 쓰는 레시피야. 5 파일, 순서대로. 각각 한 layer 대표; 함께 전체 모양 cover.
투어 route
1. src/types/index.ts — 여기서 시작. 모든 공유 타입이 이 파일에 살아: identity union (`BrainName` 같은), record 모양 (`Conversation`, `Message` 같은), event 용 discriminated union. 이 파일 읽는 게 시스템이 뭔지 읽는 거. Enum-by-convention 용 literal-union 패턴, streaming event 용 discriminated union, record interface 의 optional 필드 주목.
2. src/lib/api.ts — API client. `fetchConversations()` 같은 함수가 어떻게 return 타입을 `Promise
3. src/hooks/useChat.ts — 중앙 chat hook. SSE streaming 이 여기서 발생. Reducer state 모양 (discriminated union), action 타입 (또 다른 discriminated union), `useReducer` 의 state 와 dispatch 가 어떻게 통해 타입 붙는지 봐.
4. src/App.tsx — top-level component. 여기서 state 들어 올려짐; child component 가 typed props 받음. Component tree 가 chat, sidebar, council, admin, settings 영역 연결.
5. src/components/chat/MessageList.tsx (또는 어떤 leaf component 든) — Props 가 어떻게 inline 타입 붙고, children 이 어떻게 render 되고, callback 이 어떻게 타입 붙는지 주목.
찾을 거
읽으면서 식별:
- 보는 모든 literal-union (status 필드, enum-shaped 식별자).
- 모든 discriminated union (event, action, result).
- 모든 `import type`.
- `if`, `switch`, type predicate 통해 narrowing 발생하는 모든 자리.
- Generic 함수 signature 가 타입 보존하는 모든 자리.
- 모든 `Promise
` 와 T 가 뭔지.