ts-reset Documentation

repository·main·Indexed Jul 28, 2026

https://github.com/mattpocock/ts-reset

A library that improves TypeScript's built-in typings for common JavaScript APIs, similar to a CSS reset. It provides safer type handling for JSON.parse() and fetch responses by returning unknown instead of any, fixes type narrowing for .filter(Boolean), and improves ergonomics for array.includes on readonly arrays.

Tokens
193
Snippets
0
Records
2
Agent score
23%

What's inside ts-reset

  1. Overview of ts-reset improvements

    main
    ts-reset is a library designed to improve TypeScript's built-in typings by smoothing over common developer experience issues. It provides more type-safe and ergonomic defaults for standard JavaScript/TypeScript operations.
  2. Key improvements provided by ts-reset

    main

    ts-reset modifies several built-in behaviors to improve type safety and ergonomics:

    • JSON Parsing: Changes .json() (on fetch responses) and JSON.parse() to return unknown instead of any, forcing safer type handling.
    • Array Filtering: Fixes .filter(Boolean) so it behaves as expected by correctly narrowing types (e.g., removing null/undefined/falsy values from the resulting type).
    • Array Includes: Widens array.includes to be more ergonomic, specifically addressing issues where it often fails on readonly arrays.