메인 콘텐츠로 건너뛰기

2026-05-20 · 1분 읽기

API types용 JSON to TypeScript

sample response를 interface로 turn, code review에서 name refine.

TypeScriptJSONAPI

핵심 요점

  • nullable field 있는 real API sample — happy-path-only JSON은 optional property hide.
  • shared package publish 전 generated interface domain language로 rename.

권장 workflow

payload format, JSON validate, root name ApiUser 등으로 interface generate.

same payload tool chain 시 ?prefill=로 JSON Formatter jump.

자주 묻는 질문

mixed array union infer?

예 — array item differ면 union element type emit.

generated types commit?

review 후 commit; API contract change 시 regenerate.