HN 표시: JTC – TypeScript를 사용한 JSON/YAML 유형 검사기

hackernews | | 📰 뉴스
#json #review #typescript #yaml #유틸리티 #타입검사
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

JSON이나 YAML 파일에 $type 필드를 추가하면 TypeScript 기반의 타입 검사를 수행할 수 있는 도구인 JTC가 공개되었습니다. 이 도구는 VSCode 확장 프로그램뿐만 아니라 CLI를 제공하여 Cursor 등 다른 에디터와의 호환성을 지원하며, CI/CD 파이프라인에서의 타입 검사도 가능합니다. 개발자는 현재 자동 완성 기능과 호버 문서 표시 등을 구현 중이며, 추후 다른 정적 타입 언어 지원도 고려하고 있습니다.

본문

JTC (JSON/YAML Type Checker) JTC validates json , jsonc , and yaml documents against TypeScript types using a $type field. Write $type in your document (example: "./types.ts#MyType" ). JTC parses the document into an internal rough JSON structure. JTC runs TypeScript diagnostics for that value against the target type. Diagnostics are shown directly in VS Code. $type itself is treated as metadata and excluded from type checking. { "$type" : " ./types.ts#User " , "name" : " Alice " , "age" : 20 } ./types.ts export interface User { name : string ; age : number ; } If a value has the wrong type, JTC reports a diagnostic at the corresponding JSON/YAML path. json-type-checker : core library ( @disjukr/jtc ) jtc-cli : CLI ( jtc ) jtc-vscode : VS Code extension Prerequisites: Deno VS Code (or compatible) Build extension bundle: cd jtc-vscode deno task build Watch mode: cd jtc-vscode deno task watch Run extension dev host: Use the Extension launch configuration from .vscode/launch.json . Install CLI globally: cd jtc-cli deno task install-cli Use CLI:

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →