Home›Stefan Judis›Article

The scope of type guards and assertion functions (#tilPost)

Stefan Judis · Apr 3, 2026

I've just read Absorbing unknown Into the Type Realm. It's a good read, check it out.

However I also learned an important difference between TypeScript type guards and assertion functions. And to be fair, I didn't even know assertion functions were a thing in TypeScript.

Let's look at a standard type guard.

Keep reading

Out of respect for the author only the opening is shown here. Read the rest on the original site, or in HorizonReader with highlights, notes and AI help.

More from Stefan Judis

Web Weekly #204 (#blogPost)

Guten Tag! Guten Tag! 👋 Have you heard of CSS mixins? Are you interested in using the interestfor attribute? And are you annoyed by Apple's iOS monopoly and would like things to change? Turn on the Web Weekly tune and find some answers belo

Web Weekly #203 (#blogPost)

Guten Tag! Guten Tag! 👋 Are you ready to use scroll-driven animations now that they work in every browser? Do you know what scroll-target-group does? And do you know of good places to discover fancy fonts? Turn on the Web Weekly tune and fi

Knowember 2026 (#blogPost)

I discovered Robert's knowember page and thing it's a lovely idea. So here we go! A photo This year I discovered a new love for long distance cycling and participated in multiple 200km+ events. The photo was taken on the way to this year's

Web Weekly #202 (#blogPost)

Guten Tag! Guten Tag! 👋 Have you heard that ariaNotify is now baseline newly available? And do you wonder if JPEG XL is better than AVIF? And what's your take on Safari's new adaptive dark mode? Turn on the Web Weekly tune and find some ans

Blake Watson on the state of the industry (#note)

Here's Blake sharing his feelings about AI, software development and where we're all heading. He wrote the article that's been on my TODO list for a while. Let me comment on some highlights. I feel like I will be able to build things I neve