Civet: TypeScript superset that favors more types and less typing
Civet is a CoffeeScript-inspired superset of TypeScript adding shorthand syntax, pattern matching, pipe operators, and indentation-based JSX.
summary is enough The README outlines a dense list of syntactic sugar and configuration options that are easily grasped via a quick feature scan.
summary
Civet is a compile-to-TypeScript language introducing extensive syntactic sugar inspired by CoffeeScript, Ruby, and functional languages. It provides features like F#-style pipe operators, pattern matching, shorthand assignments, and indentation-based JSX for frameworks like Solid. While designed to reduce boilerplate and typing, it introduces strictness changes and whitespace sensitivity that deviate from standard JavaScript/TypeScript. The project includes compiler plugins for popular bundlers, a REPL, and an alpha language server.
key points
- Introduces advanced syntactic sugar including F#-style pipe operators, pattern matching, and compact lambda shorthand.
- Features indentation-based JSX designed to streamline component creation in frameworks like Solid.
- Transpiles to TypeScript and integrates with standard tooling via plugins for Vite, esbuild, Webpack, and Mocha.
- Differs from strict TypeScript/JavaScript by altering rules around arrow functions, implicit returns, and whitespace.
who should read it
Frontend developers and TypeScript users looking for extreme conciseness and modern functional programming syntax sugar.
discussion positive
consensus
Commenters appreciate the ergonomic features like pipe operators and concise syntax, though many question the practicality of adding another abstraction layer over JavaScript.
pushback
Critics point out that Civet is not a true superset because it breaks or disallows certain valid TypeScript/JavaScript constructs like specific arrow function usages and implicit returns.
Nit on the title: it doesn't appear to be a true superset, as per-
> Disallow no parens on single argument arrow function
With the large number of changes introduced, everyone bound to disagree with some of them, or how some changes are implemented. That's the downside of doing too much.
I disagree with a few things. I won't belabor it, but for one example:
> Implicit returns, even for multi-statement functions (avoid by specifying a void return type, adding a trailing ; or explicit return
This prevents me from doing command-f "return". And now the semicolon effects the function …
It details specific pitfalls with implicit returns and validates why Civet fails to be a true superset.
Generated by an LLM from the article and thread. Check the sources before relying on it.