Civet is a TypeScript-compatible language designed to reduce repetitive syntax while allowing programmers to express richer types. It transpiles Civet files into TypeScript, which can then be type-checked with TypeScript, and can also run scripts directly or integrate with common build tools and runtimes. Its central idea is to preserve familiar JavaScript and TypeScript foundations while adding concise notation and selected proposed language features, rather than requiring a separate runtime or abandoning the existing ecosystem.
The syntax includes short forms for variable declarations, imports and exports, class fields, object properties, and JSX; it also supports pattern matching, pipe operators, and compact function expressions for mapping or accessing nested properties. Civet adds type-oriented proposals such as typed destructuring and module interfaces, plus conveniences like automatic implicit returns and indentation-trimming template strings. JSX can be written with indentation and shorthand for common attributes, with options for React- or Solid-specific behavior. The project makes deliberate compatibility choices: for example, it requires parentheses around single-parameter arrow functions and changes some loop declarations to default to constants. Developers can install a command-line tool to compile, execute, or type-check projects, and use integrations for tools including Vite, Rollup, Webpack, Bun, and Jest.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.