without ts-reset
-
🚨
.json
(in fetch) andJSON.parse
both returnany
-
🤦
.filter(Boolean)
doesn't behave how you expect -
😡
array.includes
often breaks on readonly arrays
with ts-reset
-
👍
.json
(in fetch) andJSON.parse
returnunknown
-
✅
.filter(Boolean)
behaves EXACTLY how you expect -
🥹
array.includes
is widened to be more ergonomic - 🚀 And several more improvements!
Get Started
-
01
Install
npm i -D @total-typescript/ts-reset
-
02
Create a
reset.d.ts
file in your project with these contents:// Do not add any other lines of code to this file!import "@total-typescript/ts-reset"; -
Enjoy improved typings across your entire project!
Become the
TypeScript Wizard
at Your Company
A collection of professional, exercise-driven, in-depth, self-paced TypeScript workshops for you to achieve TypeScript wizardry.
Embark on Your TypeScript AdventureExample
// Import in a single file, then across your whole project...
import '@total-typescript/ts-reset'
// .filter just got smarter!
const filteredArray = [1, 2, undefined].filter(Boolean) // number[]
// Get rid of the any's in JSON.parse and fetch
const result = JSON.parse('{}') // unknown
fetch('/')
.then((res) => res.json())
.then((json) => {
console.log(json) // unknown
DOM Example
// Import from /dom to get DOM rules too!
import '@total-typescript/ts-reset/dom'
// localStorage just got safer!
localStorage.abc // unknown
// sessionStorage just got safer!
sessionStorage.abc // unknown