// the find
chenglou/freerange
Statically verify your layout code
Freerange is a TypeScript static checker that follows the range of every `number` through a restricted subset of TS and reports possible NaN, Infinity, division by zero, and out-of-bounds array reads at build time. It is aimed at teams with layout or numeric code who want those guarantees without running the app, and who are willing to write that code in an analysis-friendly style.
It runs on the official TypeScript compiler API rather than a parallel parser, so it respects tsconfig and could replace a `tsc --noEmit` step without other changes. It is honest about scope: `fr --audit` names the construct that blocked analysis instead of guessing, and the README lists its limits (no common-subexpression elimination, one excluded value per number, no higher-order function analysis). Caller requirements push a division-by-zero risk up to the same-file callers that can satisfy or violate it, which is more useful than a single flagged line. The test suite is split by analysis area (control flow, finite inputs, record properties, tagged unions) with fixtures, so the behavior is pinned down rather than asserted.
The supported subset is narrow: named top-level synchronous functions, same-file call following only, no object or array writes, no callbacks through `map` or `filter`. Real layout code with classes, closures, or imported helpers will hit 'unsupported' quickly, so adopting it means refactoring code to suit the checker. Proof power is also limited in ways that will surprise people: no transitive reasoning across comparisons, and branch merges widen ranges so safe code can still be flagged. Imported function bodies are not analyzed and it is not a repository-wide call-site verifier, so cross-module invariants remain assumptions. At 654 stars and a young changelog, there is little evidence yet of use on large codebases, and the 'adversarially tested' claim in the README is the only robustness evidence offered.