ClaudeMap

TypeChat

Microsoft's library for replacing prompt strings with type-safe TypeScript schemas.

SDKs & Toolingtypescripttype-safestructured-outputmicrosoft

TypeChat turns a TypeScript type definition into a validated prompt-and-parse pipeline. Useful when you want LLM output to flow directly into typed objects without hand-rolled JSON repair loops.

What it does

  • Schema engineering replaces prompt engineering: declare your intents as types, and TypeChat builds the prompt, validates the model reply against the schema, and repairs non-conforming output through further model interaction
  • A final step summarizes the validated instance — without using an LLM — and confirms it aligns with user intent
  • Schemas compose: extend a discriminated union to add intents, or use a meta-schema to route user input to sub-schemas
  • TypeScript/JavaScript is the first-class path; Python and C#/.NET exist as separate implementations (TypeChat.net)

When to use it

Natural-language interfaces where model output must land in typed objects: sentiment or intent classification, a shopping-cart API driven by chat, or any app where you would otherwise hand-roll JSON validation and repair loops.

Getting started

npm install typechat

Python and C#/.NET are separate codebases: see python/README.md and microsoft/TypeChat.net for working from source. Example projects live in typescript/examples; documentation at microsoft.github.io/TypeChat/.

Things to know

The README's PyPI and NuGet install lines are commented out: Python and C#/.NET are documented as work-from-source paths, not first-class package installs. TypeChat validates structure, not truth — schema-conformant output can still be factually wrong, so keep domain checks downstream.

Repository

microsoft/TypeChat

Charted

Related on the map

  • Harness Bridge

    SDK / Tool

    A local launcher that points Claude Code and seven other coding harnesses at any OpenAI-, Anthropic- or Responses-compatible endpoint — without editing a single config file.

    • launcher
    • local-models
    • cli
    • menu-bar
  • Claude for Siri

    SDK / Tool

    Answers macOS Spotlight and Siri prompts with your signed-in Claude Code account — an experimental macOS 27 model-delegation provider.

    • macos
    • siri
    • spotlight
    • model-delegation
  • Extract your own local chat history from ten AI coding assistants into one normalized JSONL — for fine-tuning, analytics, or backing up years of conversations. Standard library only.

    • cli
    • data-export
    • jsonl
    • backup