Live data from Hacker News

Goscript: Transpile Go to human-readable TypeScript

github.com

11–13 of 13 posts

Re: Goscript: Transpile Go to human-readable TypeScript

#12
post #2

Interesting I feel like I'd rather go the other way, write something in a language with nice syntax and features, then transpile to go

Try this! It works going the other way, just use esbuild to target ES2020 before you run in it. If you want to transpile to Go that's also interesting, probably tsgo's ast parser can be leveraged to do that. See: https://github.com/aperturerobotics/go-quickjs-wasi-reactor

Re: Goscript: Transpile Go to human-readable TypeScript

#13
post #10

hey ! i like the idea but I don't get why not using WASM instead of transpiling ? (I get the "transpiled typescript might be more readable" argument, but it seems less bullet proof / prone to unexpected behavior)

There are many environments that don't support WASM yet. Plus, JavaScript is a lot lighter weight for some things - particularly if you just need to register a bunch of callbacks that process data when events come in. I'm using WASM too quite a bit, though! Try out tinygo, gopherjs, or Go's built in wasm/wasi support for that.
Post reply on HN