Stop using type assertions. When you use "as User", you tell the compiler to trust you. You are not verifying anything. If the API returns a null value where you expect a string, your app will fail.
You cannot accidentally change the name because it stays inside the function scope. You write the logic once and reuse it many times. Constructor Functions Constructor functions also create objects.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results