Skip to content

Prelude TypeScript

Note

This module builds on top of the shared Programming module.

Packages

This module relies on Emacs' built-in tree-sitter support and LSP, so it doesn't pull in any third-party packages:

  • typescript-ts-mode / tsx-ts-mode - tree-sitter powered major modes for TypeScript and TSX (built into Emacs 29+)

Features

Code intelligence is provided by an LSP server (Eglot by default):

  • Code completion (via company-mode)
  • Syntax checking (via Flymake or Flycheck)
  • Eldoc integration for inline type information
  • Navigation, refactoring, and documentation lookup

Prerequisites

The tree-sitter modes need the TypeScript grammars installed. You can grab them with:

(treesit-install-language-grammar 'typescript)
(treesit-install-language-grammar 'tsx)

For code intelligence you need Node.js and a language server. The default is typescript-language-server:

npm install -g typescript typescript-language-server

Format on Save

For automatic formatting on save, enable the Apheleia module. It runs prettier (or another configured formatter) asynchronously whenever you save a TypeScript buffer.