mini-typescript

A miniature model of the Typescript compiler, intended to teach the structure of the real Typescript compiler

MIT License

Stars
31

mini-typescript

This is a fork from Nathan Shively-Sanders's mini-typescript.

The purpose of this repo is to practice the exercises and learn more about compilers and TypeScript.

To get set up

# Get set up
npm i
npm run build

# Or have your changes instantly happen
npm run build --watch

# Run the compiler:
npm run mtsc ./tests/singleVar.ts

Limitations

  1. This is an example of the way that Typescript's compiler does things. A compiler textbook will help you learn compilers. This project will help you learn Typescript's code.
  2. This is only a tiny slice of the language, also unlike a textbook. Often I only put it one instance of a thing, like nodes that introduce a scope, to keep the code size small.
  3. There is no laziness, caching or node reuse, so the checker and transformer code do not teach you those aspects of the design.
  4. There's no surrounding infrastructure, like a language service or a program builder. This is just a model of tsc.

Exercises

Related Projects