Code Read the original on Infoq 2 min read 0

Dominic Gannaway releases TSRX as a framework-agnostic JSX successor

Dominic Gannaway, the former core engineer for React and Svelte, has launched TSRX in its alpha phase. This new TypeScript language extension aims to serve as a framework-agnostic successor to JSX by compiling single component files into multiple runtime targets. By moving common UI ergonomics from convention into syntax, TSRX allows developers to build declarative user interfaces that work across various ecosystems including React, Solid, and Vue.

Стилізований ноутбук із кодом на синьому фоні в оточенні плаваючих іконок шестірок, лампи, вікон редактора та символів програмування.
Стилізований ноутбук із кодом на синьому фоні в оточенні плаваючих іконок шестірок, лампи, вікон редактора та символів програмування. · Image source: Infoq

According to Infoq, Dominic Gannaway has introduced TSRX, a new TypeScript language extension designed to provide a unified authoring syntax for building declarative user interfaces. The project is positioned as a spiritual successor to JSX, having been extracted from the Ripple framework but modified to remain independent of any specific runtime environment.

Framework-agnostic compilation and plugins

TSRX operates by compiling a single .tsrx component file into multiple output targets simultaneously. Rather than being tied to one library, it utilizes a plugin system where specific modules like @tsrx/react, @tsrx/preact, @tsrx/solid, and @tsrx/vue walk a shared Abstract Syntax Tree (AST) to emit idiomatic code for each respective framework. This architecture allows developers to add new targets as standalone compiler plugins without needing to modify the core language itself.

The technology introduces several syntax-level improvements intended to streamline UI development, including:

  • Statement-level control flow using @if, @for, @switch, and @try directives.
  • Prop shorthands and lazy destructuring for cleaner component definitions.
  • Component-scoped styles that the compiler automatically rewrites with unique hashes.
  • Declarative error and async boundaries expressed through @try, @catch, and @pending instead of wrapper components.

Ecosystem compatibility and adoption

While TSRX is currently in alpha, it offers broad integration support for modern build tools including Vite, Rspack, Turbopack, and Bun. Because a .tsrx file compiles into a standard .tsx equivalent, teams can adopt the technology on a per-file basis without requiring a full codebase migration. However, early documentation advises users to experiment with the tool rather than performing large-scale migrations immediately.

The release has sparked significant debate within the developer community regarding the future of web development syntax. While some users praise the ergonomic improvements, others argue that the industry should move toward functional builders like those found in Kotlin or F# to avoid the "XML inside JS" patterns that TSRX seeks to refine. Despite these debates, TSRX represents a notable shift toward standardized authoring syntaxes for the growing TypeScript ecosystem.

FAQ

What frameworks does TSRX support?
TSRX provides plugins to emit idiomatic code for several popular frameworks including React, Preact, Solid, and Vue. It uses a plugin system that allows developers to add new targets as standalone compiler plugins without modifying the core language.
Can I migrate my entire project to TSRX at once?
TSRX files compile into standard .tsx equivalents, allowing teams to adopt the technology on a per-file basis. However, early documentation advises users to experiment with the tool rather than performing large-scale migrations immediately.
Telegram

Fresh news on our Telegram

Get instant alerts for new posts in «Code»

@procodeandevenmore