GoScript
lastmod 2026-02-16created 2026-02-161 edits
A transpiler that converts Go code to TypeScript
About
- An AST-based transpiler developed to share business logic between Go and TS
- Converts Go algorithms, data structures, and concurrency logic to TypeScript, enabling code reuse between backend and frontend
- Maps Go's main features such as Struct, Interface, Channel, Goroutine, Pointer, Slice, and Map to TypeScript syntax
- Goroutines are converted to async/await-based asynchronous processing, so they can run in a browser environment too
- Implements pointer references and pass-by-value through the VarRef system
- Supports advanced language features such as Generics, Reflection, Closures, and anonymous functions
- Mostly compatible with the standard library, including encoding/json; Reflection and some standard library extensions are in progress
- Provides both a CLI and an API
- CLI: compiles a Go package to TypeScript in the form goscript compile --package . --output ./dist
- Conversion can be called directly within a program through the Go API and Node.js API