Civet: TypeScript superset that favors more types and less typing github.com · 1...
HN Best 200 @best
Civet: TypeScript superset that favors more types and less typing github.com · 10 points · 2 comments · HN thread
TL;DR Civet is a TypeScript-targeting language and compiler, installable via npm as @danielx/civet, that adds CoffeeScript-influenced syntax such as pipes, pattern matching, implicit returns and JSX shorthands. The GitHub README covers CLI usage, type checking, build plugins for many bundlers, and a list of language changes from ES6/TypeScript. The Hacker News thread is tiny, with two comments.
- Civet compiles to TypeScript or JavaScript; it is installed with npm install -g @danielx/civet and offers a REPL, a file compiler and a node --import register hook.
- Language features include a pipe operator (|>), pattern matching in switch, short function syntax like x.map &.name, and implicit returns.
- Solid and JSX-related shorthands are included, such as #id and .class attribute sugar and 'civet solid' type flags.
- Type checking runs through the TypeScript compiler via civet --typecheck, and plugins exist for Vite, esbuild, Webpack, Babel, Jest, Bun and others.
- The language deliberately departs from JavaScript in places, for example requiring parentheses around single arrow function arguments and disallowing the comma operator in conditionals.
- The project describes itself as a superset of TypeScript, which a commenter disputes given the listed incompatibilities.
Discussion The thread is very small, with two comments. One commenter says they like CoffeeScript-style syntax and points out that the project's own list of changes from ES6 means it is not a true superset of TypeScript, since a superset must accept all valid TypeScript. A reply jokes about the name and singles out the pipe operator as something they wish JavaScript and TypeScript had. The mood is mild and mostly neutral.
- Superset claim is inaccurate (some): One commenter argues that because Civet changes several ES6 behaviors, it cannot be a strict superset of TypeScript as its name and description suggest.
- Appreciates pipe operator and CoffeeScript-style syntax (some): Commenters like the CoffeeScript-influenced syntax, and one singles out the pipe operator as a feature they wish mainstream JavaScript had.