[{"data":1,"prerenderedAt":80},["ShallowReactive",2],{"/2025/12/18-null-safe-nullable-variable":3},{"id":4,"title":5,"body":6,"date":71,"description":54,"extension":72,"meta":73,"navigation":74,"path":75,"robots":76,"seo":77,"stem":78,"__hash__":79},"posts/2025/12/18 null-safe-nullable-variable.md","18 Null Safe Nullable Variable",{"type":7,"value":8,"toc":68},"minimark",[9,18,21,28,30,42,55,57,60],[10,11,13],"post-title",{":date":12},"date",[14,15,17],"h1",{"id":16},"null-safe-nullable-variable","Null Safe Nullable Variable",[19,20],"br",{},[22,23,24],"danger",{},[25,26,27],"p",{},"Please don't do this unless there's a solid reason.",[19,29],{},[25,31,32,33,41],{},"So, I happened to see Javascript code similar to the following on a production app which I can't see the reason. Assuming ",[34,35,40],"code",{"className":36},[37,38,39],"bg-gray-200","p-2","rounded","redirectUrl"," is never null.",[43,44,45],"code-block",{},[46,47,52],"pre",{"className":48,"code":50,"language":51},[49],"language-text","const url = isRedirect ? redirectUrl : \"null\";\n","text",[34,53,50],{"__ignoreMap":54},"",[19,56],{},[25,58,59],{},"The above renders the check further down useless:",[43,61,62],{},[46,63,66],{"className":64,"code":65,"language":51},[49],"if (url) {\n  // Do something\n}\n",[34,67,65],{"__ignoreMap":54},{"title":54,"searchDepth":69,"depth":69,"links":70},2,[],"2025-12-18T00:00:00.000Z","md",{},true,"/2025/12/18-null-safe-nullable-variable",null,{"title":5,"description":54},"2025/12/18 null-safe-nullable-variable","MEI_stn4A06CCPzMxr4O8_WeU3YIJOq1J4gMP5ggNB4",1785167452123]