Make JSON.parse and fetch response parsing return 'unknown' instead of 'any' so TypeScript forces you to check the data
Fix .filter(Boolean) so TypeScript correctly understands the resulting array has no null or undefined values
Eliminate false TypeScript errors when checking if a value exists in a readonly array using .includes()
ts-reset is a small TypeScript library that fixes several frustrating quirks in TypeScript's built-in type definitions for everyday JavaScript features. TypeScript is a programming language that adds type-checking on top of JavaScript, helping catch mistakes before code runs. However, some of the types that TypeScript ships with for standard JavaScript tools are intentionally loose or produce awkward behavior in practice. The library takes its name from the concept of a CSS reset, a small stylesheet that browser developers use to neutralize inconsistent default styles before writing their own. ts-reset does the same thing for TypeScript: it patches a handful of built-in definitions so they behave more sensibly without you having to write workarounds yourself. The README lists three specific problems it addresses. First, when you fetch data from an API and parse the response as JSON, or when you call JSON.parse directly, TypeScript currently types the result as any, meaning it skips type-checking entirely. ts-reset changes this to unknown, which forces you to check what you actually received before using it. Second, a common JavaScript pattern of filtering an array to remove empty values does not narrow the type correctly in standard TypeScript, but ts-reset makes it work as most developers would expect. Third, checking whether a value is in a readonly array with array.includes often causes a type error, ts-reset widens the check to remove that friction. The README is brief and points to full documentation on the Total TypeScript website for installation instructions and a complete list of changes. The project was created by Matt Pocock, a well-known TypeScript educator.
← mattpocock on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.