anguyen
anguyen

Reputation: 477

TypeScript Implementation Language

I have been poking around at the TypeScript compiler and found this curious statement in the language spec:

TypeScript compiler is implemented in TypeScript

Is this even possible? I must believe that tsc (TypeScript Compiler) must have largely been developed in Javascript, but maybe I am missing something here.

Upvotes: 1

Views: 284

Answers (1)

Ryan Cavanaugh
Ryan Cavanaugh

Reputation: 220954

It is true. You can read the code yourself.

The key to bootstrapping a language like this is that you do start in JavaScript, gradually refactoring your code into TypeScript as you add language features. It's been a very long time, though, since the TypeScript compiler was pure JS. Obviously this does cause some pain whenever breaking design decisions are made (if you poke around in the testcases you'll see references to things like 'oldclass' and 'es6class' and other historical oddities).

Upvotes: 4

Related Questions