JTC validates json, jsonc, and yaml documents against TypeScript types using a $type field.
- Write
$typein 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 buildWatch mode:
cd jtc-vscode
deno task watchRun extension dev host:
- Use the
Extensionlaunch configuration from.vscode/launch.json.
Install CLI globally:
cd jtc-cli
deno task install-cliUse CLI:
jtc --help