Does anyone know how to generate a .d.ts from a string, e.g. "export const foo = 42"?
The API reference:
https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API
shows how to generate the compiled .js from a string, but to generate the .d.ts it only gives references for how to do it using a filesystem.
The typescript playground does exactly this, however (and without any network traffic, so it's not writing files on some server and extracting the .d.ts), so it's somehow possible.