JSFiddle - React, Tailwind, and code Playground
TypeScript
const removeSadDick = () => {
let currentDicks = localStorage.getItem("Dicks");
if(isDickExist(currentDicks)) {
let parsedDicks = JSON.parse(currentDicks); // "Argument of type 'string | null' is not assignable to parameter of type 'string'.\n Type 'null' is not assignable to type 'string'."
localStorage.setItem("Dicks", JSON.stringify(currentDicks.filter((dick: Dick) => dick.name != name)))
}
}