Blog Logo
TAGS

TypeScripts ts-reset makes built-in typings better

The built-in typings in TypeScript arent perfect but ts-reset is here to help. Without ts-reset, .json (in fetch) and JSON.parse both return any, .filter(Boolean) doesnt behave as expected, and array.includes often breaks on readonly arrays. ts-reset smooths over these hard edges by making .json (in fetch) and JSON.parse both return unknown, .filter(Boolean) behaves EXACTLY how you expect by filtering out falsy values, and array.includes is widened to be more ergonomic. By importing @total-typescript/ts-reset and creating a reset.d.ts file in your project, you can enjoy improved typings across your entire project. However, ts-reset is designed to be used in application code, not library code, and some rules require NodeNext or Node16 module in tsconfig.json.