jgm / djot.js

JavaScript implementation of djot
MIT License
146 stars 16 forks source link

enable isolatedModules flag for tsc #21

Closed matklad closed 1 year ago

matklad commented 1 year ago

The theory behind tsc is that it's a "null" compiler, in a sense that it just strips type annotations. As a corollary, purely syntax-based compiler which just erases type annotations should be correct.

Sadly, this property was eroded at some point, and this days the result of type-script compilation sometimes depends on the types. This breaks tools which try to process file-at-a-time.

The isolatedModules flag closes this loophole.

In my particular case, I am using djot from deno, and that does require this flag to be set.

The impact for djot is pretty minimal: we just need to flag some exports as type-only exports, so that it is clear without context that they compile down to nothing.