0Pricing
TypeScript Academy · Lesson

Creating a TypeScript Program with the API

Initialize a compiler program and access the type checker.

What Is the Compiler API?

TypeScript exposes its compiler internals through the typescript npm package. You can create programs, inspect the type checker, and analyze source files programmatically.

import ts from "typescript";
// Use ts.createProgram to start

Installing the typescript Package

Install TypeScript as a regular dependency (not just devDependency) when using the compiler API in your tools.

npm install typescript
# Also install types if needed
npm install --save-dev @types/node

All lessons in this course

  1. Creating a TypeScript Program with the API
  2. Traversing the AST with Visitors
  3. Custom Transformers and Code Generation
  4. Building a Simple Linting Tool
← Back to TypeScript Academy