DanielXMoore/Civet
FreeA TypeScript superset that favors more types and less typing
FreeFree tier
About DanielXMoore/Civet
Civet is a modern superset of TypeScript that introduces concise syntax and implements new and proposed ECMAScript features such as pattern matching, pipe operators, and short function blocks. It compiles directly to TypeScript or JavaScript, integrates with popular build tools (Vite, esbuild, Webpack, etc.), and offers a REPL, VSCode extension, and type-checking support. As a free, open-source project, Civet aims to reduce boilerplate while maintaining full compatibility with existing TypeScript ecosystems.
Key Features
Pattern matching based on the TC39 proposal
Pipe operator supporting F# pipes, Hack pipes, and the TC39 proposal
Short function block syntax (e.g., x.map .name for x.map(a => a.name))
Nested access and slices (e.g., x.map .profile?.name[0...3])
Unary and binary operator shorthand (e.g., x.map !! or x.map +1)
Object literal shorthand (e.g., {foo()}, data.{x,y}, flagging shorthand like {+debug, -live})
Custom infix operators from any two-argument function
REPL for direct execution of .civet code
Transpilation to TypeScript and JavaScript
Type checking via --typecheck flag
Pros & Cons
Pros
- Reduces boilerplate and increases code readability through concise syntax
- Fully compatible with TypeScript, allowing gradual adoption in existing projects
- Early access to proposed JavaScript features like pattern matching and pipes
- Free and open source with an active community (Discord, GitHub)
- Plugins for major build tools make integration seamless
- Supports type checking via standard TypeScript compiler
Cons
- Requires familiarity with TypeScript to use effectively
- Novel syntax and shorthands may have a learning curve for new users
- Still an evolving superset; not all proposed features are finalized
- Smaller community and ecosystem compared to mainstream TypeScript
- Some tools (e.g., ESLint, Prettier) may need additional configuration to support .civet files
Best For
Writing concise and expressive TypeScript code with less boilerplateExperimenting with upcoming ECMAScript features before official releaseBuilding web applications using frameworks like Solid, Astro, or Vite with Civet supportSimplifying data transformations with pipe operators and shorthand syntaxCreating DSLs or custom syntax using custom infix operators and pattern matching
FAQ
What is Civet?
Civet is a superset of TypeScript that adds concise syntax and implements new and proposed ES features such as pattern matching, pipe operators, and short function blocks. It compiles to TypeScript or JavaScript.
How do I install Civet?
Install the CLI globally via npm: npm install -g @danielx/civet. Then use the civet command to run a REPL, compile files, or execute scripts.
Does Civet support type checking?
Yes. You can type-check entire projects by running 'civet --typecheck'. This requires TypeScript to be installed globally.
Can I use Civet with my existing build tools?
Civet provides plugins for Vite, esbuild, Astro, Farm, Rolldown, Rollup, Webpack, Babel, Jest, Gulp, Bun, and more. There is also an ESM/CJS loader and a script tag bundler.
Is Civet free?
Yes, Civet is completely free and open-source under the MIT license.
Where can I get help or discuss Civet?
The Civet community is active on the official Discord server. You can also open issues or discussions on the GitHub repository.