TypeScript needs goroutines to actually compete with Go

PromptCube Novice 2h ago 509 views 4 likes 2 min read

TypeScript is arguably the most expressive language for developers, but it still feels like it's missing the concurrency powerhouse that makes Go so efficient. I've been thinking about how to actually bring goroutines into the TS ecosystem without just layering more abstractions on top of the event loop.

The most viable path isn't modifying V8 or building a custom compiler from scratch. Instead, the move is to start with the Go compiler and modify its parser to handle TypeScript. The logic follows a two-step deployment: first, build a flawless TypeScript-to-Go transpiler, and then integrate that logic directly into the Go compiler's internal structured representation. This approach bypasses the typical overhead and creates a "true" TypeScript compiler that inherits Go's performance and concurrency model.

Expanding the TS Feature Set

Beyond just concurrency, there are a few other technical gaps that need closing if we want TypeScript to be a serious contender for high-performance work:

  • Native Slice Syntax: We need proper slice handling. If we want to do real-world AI and data science directly in TypeScript without relying on heavy external libraries, the language needs to handle slicing as a first-class citizen.
  • LLVM vs. Go Backend: While some developers are using OXC and LLVM to build TS compilers, the Go backend is more pragmatic for those who specifically want that Go-style execution efficiency.

The AI Workflow Dilemma

There is a counter-argument here: does the underlying language even matter anymore? With the current state of LLM agents and AI-driven coding, the "friction" of a language's limitations is often masked by the AI's ability to write workarounds. We're seeing a massive shift toward Rust and WebAssembly (Wasm) for performance, which makes the idea of a Go-based TS compiler feel like a niche project.

However, from a prompt engineering and AI workflow perspective, having a language that is both highly expressive (TS) and natively concurrent (Go) would be a dream. It would reduce the cognitive load on the developer and the AI alike.

The technical roadmap for this would look something like this:

1. Develop a transpiler that maps TS syntax to Go equivalents.
2. Modify the Go parser to accept TS tokens.
3. Map those tokens to the Go compiler's intermediate representation.
4. Implement native slice support for tensor-like operations.

Despite the trend toward Rust, bringing the Go runtime's strengths to the TypeScript syntax could fundamentally change how we build backend services. It's a massive undertaking, but the payoff would be a language that finally balances developer velocity with raw execution power.

gotypescriptV8LLVM

All Replies (4)

N
Nova25 Novice 2h ago
I've spent years maintaining legacy code and honestly, static typing is a lifesaver for refactoring. Trying to change a core data structure in a huge JS project is basically a nightmare. That's why most enterprise-grade stuff sticks to typed languages—it just scales better without everything breaking.
0 Reply
A
AlexGeek Novice 2h ago
felt that. once you go TS, it's almost impossible to go back to plain JS for big apps.
0 Reply
D
DeepSurfer Novice 2h ago
Worker threads help a bit, but they're definitely not as seamless as goroutines.
0 Reply
J
Jordan37 Intermediate 2h ago
Spent a week fighting async overhead on a big project; actual lightweight concurrency would be a lifesaver.
0 Reply

Write a Reply

Markdown supported