Civet: TypeScript superset that favors more types and less typing
Daniel X Moore released Civet as a concise TypeScript superset featuring TC39 pattern matching, pipe operators, and build plugins across Vite and Webpack.
By Dillip Chowdary • Nov 29, 2026 • Source: github.com

At a glance
- Product
- Civet
- Distribution package
- @danielx/civet via npm
- Typechecking dependency
- Requires external TypeScript compiler
- Editor tooling
- Civet Language Server alpha
- Supported runtimes
- Node.js and Bun
- Build integrations
- Vite, esbuild, Astro, Webpack, Rollup, Bun
In this post
Daniel X Moore published the Civet programming language repository, presenting a syntactic superset of TypeScript designed to provide concise syntax without sacrificing static typing constraints. According to github.com's report, the open-source project transpiles directly into standard TypeScript while implementing proposed ECMAScript standards and functional programming idioms. The release provides a standalone command-line compiler, dedicated editor integrations, and plugin packages spanning build pipelines like Vite, esbuild, Astro, Farm, Rolldown, Rollup, Webpack, Babel, Jest, Gulp, and Bun.
This report details the architectural features, shorthand syntactic conventions, JSX compilation enhancements, and toolchain configurations comprising the Civet development environment. Frontend engineers, full-stack TypeScript developers, and framework maintainers seeking reduced typing overhead without sacrificing compile-time safety can evaluate its tooling integration and syntax transformations.
01Quickstart commands and bundler integration plugins
The toolchain distributes as an npm package under @danielx/civet and integrates directly into major JavaScript bundlers and runtimes. Developers can embed the compiler inside existing toolchains through official plugins for Vite, esbuild, Astro, Farm, Rolldown, Rollup, Webpack, Babel, Jest, Gulp, and Bun. The project also provides starter templates for Solid and Solid Start, alongside a browser playground, Discord community server, and dedicated VSCode extension.
- Global installation Run npm install -g @danielx/civet to install the core compiler and CLI binary.
- Interactive evaluation Launch civet to start an interactive REPL session or execute civet -c to transpile typed code directly.
- File compilation Pipe source files through civet < source.civet > output.ts to generate standard TypeScript definitions.
- Script execution Run civet source.civet with arguments or execute under Node using node --import @danielx/civet/register source.civet.
- Type verification Install TypeScript globally via npm install -g typescript and execute civet --typecheck across the project.
Running Civet in production workflows requires standard Node.js support where scripts execute directly through the module registration hook. The compiler preserves original shebang lines like #!./node_modules/.bin/ts-node without modification so executable command-line scripts function reliably across operating systems. Project-wide verification requires installing the official TypeScript package globally to ensure type consistency before shipping production bundles.
02Pipeline operators and pattern matching expressions
Civet incorporates advanced functional programming patterns derived from active TC39 proposals and languages such as F#, Hack, Ruby, Crystal, and Elm. Pattern matching allows switch statements to inspect structured objects like [{type: "text", name}, ...rest] while automatically introducing block scopes and breaks for when branches. Developers can write pipeline chains such as data |> Object.keys |> console.log, which the compiler transforms into standard nested function calls like console.log(Object.keys(data)).
Pipelines support single-argument arrow functions or the ampersand shorthand to specify how expressions consume the left-hand operand. Trailing operations can wrap incoming values by appending |> await, |> yield, or |> return at the conclusion of an expression chain. Short function block syntax simplifies collection methods by converting x.map &.name into x.map(a => a.name) and mapping unary expressions like !!& directly into anonymous functions.
Collection traversals also support nested property access and slice notation through operations such as x.map &.profile?.name[0...3], which compiles into standard slice calls. Arithmetic evaluations accept binary shorthand like x.map &+1 or arbitrary callback invocations like x.map &.callback a, b without requiring explicit parameter declarations. In addition to pipeline transformations, the grammar provides custom infix operators generated from two-argument functions alongside do expressions, if expressions, and for expressions.
03Shorthand variable assignments and import mechanics
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
Variable declarations in Civet offer concise assignment symbols that replace verbose JavaScript keywords while maintaining explicit mutability. The assignment a := b declares a constant variable equivalent to const a = b, and destructuring patterns like {a, b} := c expand into const {a, b} = c. Mutable variables use the period-equal operator a .= b for let declarations, supporting optional type annotations like a: number .= 5.
| Civet expression | Compiled TypeScript equivalent | Syntactic pattern | | a := b | const a = b | Constant assignment shorthand | | a .= b | let a = b | Mutable let assignment | | {+debug, -live, !verbose} | {debug: true, live: false, verbose: false} | LiveScript boolean flag shorthand | | x from ./x | import x from "./x" | Unquoted module import | | import {x: y} from "./z" | import {x as y} from "./z" | Destructuring style import rename | | export x, y | export {x, y} | Export list shorthand |
Module management simplifies standard ECMAScript module syntax by allowing unquoted path imports like x from ./x and export lists like export x, y. Dynamic imports invoked outside the top level automatically compile into import('./x') expressions when written as await import './x'. Class definitions feature shorthand constructors @( ... ), class static blocks via ClassStaticBlock @ { ... }, the less-than symbol as an extends replacement, and @#id for private field identifiers.
04Indented JSX templates and attribute shorthands
Inspired by discussions around solid-dsl and the JSX specification, Civet introduces significant syntactic upgrades for modern component markup. Developers do not need to write closing tags or empty fragment delimiters because child indentation automatically signals tag closures and groups adjacent sibling elements into fragments. Arrow functions passed as children omit outer braces when not preceded by text, allowing patterns like For with (item) => to remain clean and readable.
Attribute declarations provide dedicated shorthands including #foo for id="foo" and .foo for class="foo", with support for dynamic template expressions. Boolean properties use +foo for true and -foo or !foo for false, while braced objects like {foo} compile directly to attribute assignments foo={foo}. The compiler accepts unbraced expressions without whitespace, translating assignments like count=count(), sum=x+1, and list=[1, 2, 3] into braced attributes automatically.
Directive flags modify JSX output to align with target frontend libraries and runtime deployment targets. Adding "civet react" instructs the compiler to generate className properties instead of standard class attributes across elements. For Solid applications, the "civet solid" directive applies specialized element typing, accepting "civet solid client" for client bundles, "civet solid server" for server rendering, and "civet solid client server" for isomorphic hydration.
05Compiler pipeline and language server tooling
Civet modifies traditional ECMAScript syntax to prevent ambiguity while automatically rewriting import file extensions from .mts and .cts to .mjs and .cjs. Multi-statement functions employ implicit returns unless configured otherwise with void return types, explicit return statements, semicolons, or the "civet -implicitReturns" directive. The compiler enforces parentheses on single-argument arrow functions, prevents numbers from ending with dots, and reserves keywords like and, or, loop, until, and unless.
Note: The official Civet Language Server remains in an alpha development release while delivering syntax highlighting, autocompletions, hover documentation, symbols outlines, diagnostic red squigglies, and go-to-definition capabilities across VSCode environments. Project-wide static typechecking requires installing the official TypeScript compiler globally because Civet delegates type analysis directly to the underlying TypeScript engine.
Testing workflows integrate with c8 and Mocha by configuring the @danielx/civet/esm loader inside package.json to maintain accurate source maps. Test suites can mix .civet, .ts, .js, and .coffee files together and execute seamlessly through pnpm test. In addition, experimental decorators utilize the double at-symbol @@ to decorate classes and methods, reserving the single at-symbol for object references, static fields, and Svelte style label syntax.
Frequently asked questions
What is Civet and how does it relate to TypeScript?
Civet is a syntactic superset of TypeScript that transpiles source code into standard TypeScript or JavaScript. It provides concise syntax extensions and proposed ECMAScript features while maintaining full compatibility with existing TypeScript types.
How do developers install and run Civet from the command line?
Developers can install the compiler globally using npm install -g @danielx/civet. The command-line interface provides the civet REPL, civet -c for transpilation, and civet --typecheck for project-wide type analysis with TypeScript.
Does Civet support modern frontend frameworks like React and Solid?
Yes, Civet includes dedicated configuration directives like "civet react" for className output and "civet solid" for Solid JSX types. It also provides official plugin integrations for tools such as Vite, Astro, esbuild, and Webpack.
How does Civet handle testing and code coverage?
Civet integrates with c8 and Mocha using the @danielx/civet/esm loader to provide out-of-the-box code coverage and source map tracking. Test suites can execute .civet files alongside standard .ts and .js files using pnpm test.
Sources
Author
Dillip Chowdary
Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.
Related on Tech Bytes
Advertisement