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
Что это?TSRX (TypeScript Render Extensions) — языковое расширение TypeScript для построения декларативных пользовательских интерфейсов, объединяющее в файлах .tsrx TypeScript-код, JSX-подобную структуру, управляющие конструкции шаблонов и стили с областью действия на уровне смежных элементов; всё это компилируется в идиоматичный вывод для выбранного UI-рантайма.
Это новый язык или просто плагин-компилятор для существующего фреймворка?Это новый, независимый от фреймворков язык со своим парсером и AST; целевой компилятор (для React, Preact, Solid, Vue, Ripple, Octane) затем превращает этот AST в специфичный для фреймворка вывод.
Как добавить TSRX в проект?Используйте одну из интеграций сборки для Vite, Rspack, Turbopack или Bun плюс соответствующий пакет целевого компилятора (например, @tsrx/react, @tsrx/vue) и пишите компоненты в файлах .tsrx.
Нужна ли определённая версия Node для работы с этим репозиторием?Да, проект требует Node 22 или новее, а также pnpm 11.15.1 и npm 11.6.2+.
Готов ли TSRX к продакшену?Нет, TSRX прямо помечен как находящийся в активной бета-разработке, так что ожидайте постоянных изменений.
На какие фреймворки можно нацеливать компоненты TSRX?React, Preact, Solid и Vue поддерживаются непосредственно в этом репозитории, а Ripple и Octane — через внешние интеграции компиляторов.
Какие редакторы получают поддержку инструментов TSRX?VS Code имеет полноценное расширение синтаксиса/диагностики/автодополнения, у Zed есть расширение в его маркетплейсе, плагин JetBrains на рассмотрении, а интеграции для Neovim и Sublime Text также поддерживаются в этом репозитории.
Что реально делает блок стилей с областью действия на смежных элементах?Блок стилизует своих соседей и всё ниже их в шаблоне, соседние блоки разделяют один сгенерированный хеш-класс, а назначаемые темы стилей предоставляют $class, который можно встраивать в другие элементы.
Как TSRX обрабатывает шаблонную логику вроде циклов и условий?Вместо написания обычных JSX-выражений TSRX предоставляет директивы, нативные для шаблонов, такие как @if, @for, @switch и @try, для декларативного потока управления внутри разметки.
What are similar projects?core, mitosis, pretty-ts-errors, tamagui, esbuild, mdx, tiptap, konva
Creator
tsrx-org
Size
35.9 MB
Stars
180
Age
1mo
Commits · 90 Days