Fuck it, I don’t know who made it. Shit sucks in excess, just use a little bit. The OP is using it like it’s ketchup on old McDonald’s fries. I get it, JS sucks, but your crappy JS sucks even more with drenched awful Typescript ketchup that looks like unreadable gibberish.
Nothing makes me lol more than?.a?.conditional? null check in a ‘type safe’ language. Just stop it, use C# Blazor to write your Frontends and call it a day. JS is not (your) tool for the job (because oh god, what if you don’t know a param is a string, lord have mercy, how did the web even make it this far without this type safety brilliance?).
Enough.