typenix: Full typing for Nix based on TypeScript

52 points by knl


knl

What I find amazing:

How it works: instead of building a new checker for Nix, it maps tree-sitter-nix’s AST directly to TypeScript AST nodes. The standard TS binder, type checker and LSP work almost unchanged – they never know they’re looking at Nix.

What works:

  • Hover, go-to-definition, autocomplete on builtins, lib, mkDerivation, much of main pkgs attrset
  • Runs on all 42K nixpkgs files in 13s
  • And the fun part: Fixed-point patterns (makeExtensible, finalAttrs): typed via transform to a TS class with late this binding