Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>API to TypeScript Interface GeneratorNew to Visual Studio Code? Get it now.
API to TypeScript Interface Generator

API to TypeScript Interface Generator

Ankit Semwal

| (0) | Free
Generate TypeScript interfaces, Zod schemas, Yup schemas, io-ts codecs, and runtime validators from JSON and OpenAPI documents.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

API to TypeScript Interface Generator

API to TypeScript logo

A Visual Studio Code extension that converts JSON payloads and OpenAPI documents into TypeScript interfaces and related schema formats.

JSON to TypeScript conversion overview

Features

  • Generate TypeScript interfaces or type aliases from JSON in the clipboard, editor selection, or a file
  • Support for Zod schemas, Yup schemas, io-ts codecs, and zero-dependency runtime validators
  • OpenAPI and Swagger document detection with schema generation
  • Generator panel with live preview, formatting, history, and saved templates
  • Merge generated declarations into an active TypeScript or TSX file
  • Configurable output style: export modifiers, quote style, indentation, semicolons, property ordering, and readonly/optional properties
  • Format detection for ISO dates, UUIDs, emails, URLs, and timestamps
  • String union and enum inference from repeated literal values
  • Large JSON handling with size limits and optimized parsing

Installation

From the Marketplace

  1. Open Visual Studio Code.
  2. Open the Extensions view (Ctrl+Shift+X / Cmd+Shift+X).
  3. Search for API to TypeScript Interface Generator.
  4. Select Install.

From a VSIX file

code --install-extension api-to-typescript-0.0.2.vsix

Usage

Command Palette

Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run a command from the API to TypeScript category.

Editor context menu

Select JSON in the editor, right-click, and choose Generate TypeScript Interface.

Generator panel

Run API to TypeScript: Open Generator Panel to paste JSON, preview generated output, and export results.

Typical workflows

Input Suggested command
JSON in clipboard Generate Interface from Clipboard
JSON selected in editor Generate TypeScript Interface
.json file open Generate Interface from JSON File
Active .ts / .tsx file Generate Interface into Active TypeScript File
Zod / Yup / io-ts / validators Matching Generate … from Clipboard command

Commands

Title Command ID
Generate Interface from Clipboard apiToTypescript.generateFromClipboard
Generate Interface apiToTypescript.generateInterface
Generate TypeScript Interface apiToTypescript.generateFromSelection
Generate Interface from JSON File apiToTypescript.generateFromFile
Generate Interface into Active TypeScript File apiToTypescript.generateIntoActiveFile
Open Generator Panel apiToTypescript.openGeneratorPanel
Generate Zod Schema from Clipboard apiToTypescript.generateZod
Generate Yup Schema from Clipboard apiToTypescript.generateYup
Generate io-ts Types from Clipboard apiToTypescript.generateIoTs
Generate Runtime Validators from Clipboard apiToTypescript.generateValidators

Settings

All settings are under the apiToTypescript section in VS Code Settings.

Setting Default Description
interfaceName RootModel Fallback root type name when auto-detect is disabled or unavailable
autoDetectRootName true Infer the root name from JSON shape, OpenAPI title, or filename
outputFormat typescript Default output format (typescript, zod, yup, iots, validators)
useExport true Prefix generated declarations with export
declarationKind interface Emit interface or type aliases
quoteStyle single Quote style for non-identifier property names
indentation 2 Indentation size in spaces (2 or 4)
semicolons true Append semicolons to generated members
sortProperties alphabetical Sort properties alphabetically or preserve source order
generateReadonly false Add the readonly modifier to generated properties
optionalProperties false Mark all generated properties as optional
detectFormats true Detect specialized string and number formats
detectEnums true Infer string unions or enums from repeated literals
enumStyle union Emit string unions or TypeScript enums
maxEnumValues 20 Maximum distinct literals used for enum inference
selectionOutput replace Replace selection or open a new file for selection-based generation
typescriptOutput ask Destination for clipboard/file TypeScript output (ask, newFile, updateActive)
insertAtCursor true Insert output at the cursor when an editor is active
maxJsonSizeMb 16 Maximum accepted JSON size in megabytes
largeJsonOptimizeKb 512 Disable expensive enum inference above this size in kilobytes

Example settings.json fragment:

{
  "apiToTypescript.outputFormat": "typescript",
  "apiToTypescript.declarationKind": "interface",
  "apiToTypescript.useExport": true,
  "apiToTypescript.typescriptOutput": "ask"
}

Development

npm install
npm run compile

Press F5 to launch an Extension Development Host. For watch mode:

npm run watch

Package for publishing:

npm run package
npx @vscode/vsce package

License

MIT — see LICENSE.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft