hn.today

Civet: TypeScript superset that favors more types and less typing

github.com63 points42 comments
Screenshot of Civet: TypeScript superset that favors more types and less typing

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.

Read on github.com42 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Lua as a Query Language

Lua as a Query Language

Lua can serve as a dynamic query language by expressing relational operations as Lua code that builds an AST for a Rust backend, avoiding a custom parser and Rust recompilation for ad hoc queries. Lua variables provide reusable views and built-in language features support query constructs such as filters and arithmetic. (remy.wang)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.