Vega: That would be cool! My current implementation is standalone because it actually loads the TypeScript compiler as a library, so it is also written in TypeScript.
However, a pure Nim implementation is probably possible. There is something called "tsserver" which runs the TypeScript compiler as a server and allows you to query (some subset of?) the compiler API using a socket interface. Also if you were willing to limit yourself to supporting .d.ts files, those would be much simpler to parse than full TypeScript code...