top | item 44680714

(no title)

ohnoesjmr | 7 months ago

Is there a solution to get ts compiler embeddable into c++ project that uses v8, so it could compile the code on the fly?

Seems tsc itself requires node, but surely an api that takes a ts file as a string and returns a ts file as a string should be possible?

discuss

order

orta|7 months ago

tsc's code is mostly the type-checker, you want to look for a "transpiler" here, so embedding either swc, esbuild, sucrase or the like to handle the process of converting for you. I've never heard of one written in C++ but that may exist.

silverwind|7 months ago

swc exists as wasm which any browser should be able to execute.

teaearlgraycold|7 months ago

Perhaps you could use or build a C interface for swc, a TS compiler written in rust.

Imustaskforhelp|7 months ago

they could use swc-wasm-web as tsbro also uses swc-wasm-web