Loading video player...
All right, Typescript devs, I need your
help with this bug. This function is
supposed to greet the user by name, but
instead of a friendly hello, it explodes
at runtime. Why does this compile
cleanly in Typescript, but crash the
moment you call it with no arguments?
And how would you fix it so TypeScript
catches the bug before production? Drop
your solution in the comments.
Here’s a TypeScript developer challenge that shows how optional parameters can get tricky. TypeScript accepts the code without errors. But the moment you call the function with no arguments, it blows up at runtime. Why does this compile cleanly, and what change would you make so the bug is caught during type checking instead of in production? Share your solution in the comments. Subscribe to Google for Developers → https://goo.gle/developers Speakers: Meg Bauman