tsrx README

The project's README from github.com/tsrx-org/tsrx. As one markdown file: README.md.

TSRX

Join the TSRX Discord community

TSRX

TSRX (TypeScript Render Extensions) is a TypeScript language extension for building declarative user interfaces. It keeps TypeScript setup, JSX-shaped structure, template control flow, and sibling-scoped styles together in .tsrx files, then compiles that source into idiomatic output for the runtime you choose.

Documentation · Features · Specification · Playground · Discord

TSRX is in active beta development.

Example

A component is an ordinary TypeScript function. A statement container (@{ ... }) lets local setup live beside the template that uses it, while template directives provide declarative control flow. A <style> block is scoped to its siblings: it styles the elements beside it and everything below them, and nothing else. The compiler adds a hash class to those elements so the block's selectors match only there. Here the rules apply to this fragment's <ul>.

type Todo = {
  id: string;
  title: string;
  hidden?: boolean;
};

export function TodoList({ items }: { items: Todo[] }) @{
  const visibleItems = items.filter((item) => !item.hidden);

  <>
    <ul>
      @for (const item of visibleItems; index i; key item.id) {
        <li>{i + 1}. {item.title}</li>
      } @empty {
        <li>No todos yet</li>
      }
    </ul>

    <style>
      ul {
        display: grid;
        gap: 0.5rem;
      }
    </style>
  </>
}

Features

See the features guide for examples and the TSRX specification for the language grammar, AST shape, and static constraints.

Supported targets

TSRX parses source into a framework-neutral AST and hands it to a target compiler. The same language currently supports:

Target Compiler integration Home
React @tsrx/react This repository
Preact @tsrx/preact This repository
Solid @tsrx/solid This repository
Vue @tsrx/vue This repository
Ripple @tsrx/ripple Ripple
Octane octane/compiler Octane

Additional targets can be added as standalone compiler plugins without changing the TSRX language itself.

Tooling

This repository includes the core compiler, target compilers and runtime helpers, build integrations for Vite, Rspack, Turbopack, and Bun, plus Prettier, ESLint, TypeScript, language-server, and editor tooling.

Install the TSRX Syntax for VS Code for syntax highlighting, diagnostics, navigation, completions, formatting, and TypeScript integration. The TSRX extension for Zed is available from the Zed Extension Marketplace. The TSRX plugin for JetBrains IDEs has been submitted to JetBrains Marketplace and is under review. Integrations for Neovim and Sublime Text are also maintained here.

Learn and contribute

TSRX was created by Dominic Gannaway and is released under the MIT License.

tsrx (tsrx-org/tsrx)

Searching Database…

180 ·GitHub
What is this?TSRX (TypeScript Render Extensions) is a TypeScript language extension for building declarative user interfaces, combining TypeScript setup, JSX-like structure, template control flow, and sibling-scoped styles in .tsrx files, which compile to idiomatic output for your chosen UI runtime.
Is this a new language or just a compiler plugin for an existing framework?It is a new framework-neutral language with its own parser and AST; a target compiler (for React, Preact, Solid, Vue, Ripple, Octane) then turns that AST into framework-specific output.
How do I add TSRX to my project?You use one of the build integrations provided for Vite, Rspack, Turbopack, or Bun, plus the matching target compiler package (e.g. @tsrx/react, @tsrx/vue), and write components in .tsrx files.
Do I need a specific Node version to work on this repo?Yes, the project requires Node 22 or newer, along with pnpm 11.15.1 and npm 11.6.2+.
Is TSRX production-ready yet?No, TSRX is explicitly marked as being in active beta development, so expect ongoing changes.
Which frameworks can I target with TSRX components?React, Preact, Solid, and Vue are supported directly in this repository, with Ripple and Octane supported via external compiler integrations.
Which editors get TSRX tooling support?VS Code has a full syntax/diagnostics/completion extension, Zed has an extension on its marketplace, a JetBrains plugin is under review, and Neovim and Sublime Text integrations are also maintained in this repo.
What does a sibling-scoped style block actually do?A block styles its own siblings and everything below them in the template, sibling blocks share one generated hash class, and assignable style themes expose a $class that can be composed into other elements.
How does TSRX handle template logic like loops and conditionals?Instead of writing plain JSX expressions, TSRX provides template-native directives such as @if, @for, @switch, and @try for declarative control flow inside the markup.
What are similar projects?core, mitosis, pretty-ts-errors, tamagui, esbuild, mdx, tiptap, konva
Creator
tsrx-org
Size
35.8 MB
Stars
180
Age
1mo
Commits · 90 Days