Stefan Baumgartner

Lies we Tell Ourselves As Developers

How can 10 lines of valid TypeScript still be full of runtime errors? Discover the surprising gaps in its type system.

Lies we Tell Ourselves As Developers
#1about 2 minutes

The hidden dangers in everyday TypeScript code

A seemingly simple code snippet that passes type checks can still be riddled with runtime errors that TypeScript is supposed to prevent.

#2about 2 minutes

Why network requests returning `any` breaks type safety

The `any` type returned by default from I/O operations like `fetch` allows unsafe assignments, which can be mitigated by patching interfaces to return `unknown`.

#3about 2 minutes

Handling errors safely with the `unknown` type

Since anything can be thrown in JavaScript, catch block errors are typed as `any`, but using `unknown` and `instanceof` checks provides a safer way to handle them.

#4about 2 minutes

The disconnect between function overloads and implementation

Function overloads define a public API but do not enforce that the implementation correctly returns the specified types for each overload signature.

#5about 1 minute

Using conditional types to enforce return types

Conditional types can replace function overloads to create a more complex type signature that forces the developer to correctly handle different return paths.

#6about 3 minutes

How mutability breaks TypeScript's type tracking

TypeScript does not track type changes that occur from mutable operations like `array.push`, leading to a disconnect between the static type and the runtime value.

#7about 5 minutes

The trade-offs and lies within the solutions

Each proposed solution, from declaration merging to generics, introduces its own set of new problems and potential bugs.

#8about 3 minutes

Understanding TypeScript's core design philosophy

TypeScript intentionally prioritizes developer productivity over a provably sound type system, requiring developers to understand and manage these trade-offs.

#9about 3 minutes

The developer's role is to make conscious decisions

Software engineering is about making informed decisions and choosing the right tools and patterns for your team, rather than following dogmatic advice.

#10about 6 minutes

Q&A on Rust, `instanceof` alternatives, and `ts-reset`

The speaker answers audience questions about his favorite language (Rust), using Zod for runtime type checking instead of `instanceof`, and the trade-offs of using `ts-reset`.

Related jobs
Jobs that call for the skills explored in this talk.

test

Milly
Vienna, Austria

Intermediate

test

Milly
Vienna, Austria

Intermediate

Featured Partners

Related Articles

View all articles
TL
Thomas Limbüchler
What is TypeScript?
Since Angular 2 at the latest, TypeScript has been known to many. But what exactly can you do with it, and is it worth changing?Anyone who has worked with programming languages ​​such as Java or C# before will have noticed that JavaScript allows a su...
What is TypeScript?
CH
Chris Heilmann
Dev Digest 138 - Are you secure about this?
Hello there! This is the 2nd "out of the can" edition of 3 as I am on vacation in Greece eating lovely things on the beach. So, fewer news, but lots of great resources. Many around the topic of security. Enjoy! News and ArticlesGoogle Pixel phones t...
Dev Digest 138 - Are you secure about this?
CH
Chris Heilmann
All the videos of Halfstack London 2024!
Last month was Halfstack London, a conference about the web, JavaScript and half a dozen other things. We were there to deliver a talk, but also to record all the sessions and we're happy to share them with you. It took a bit as we had to wait for th...
All the videos of Halfstack London 2024!
CH
Chris Heilmann
Dev Digest 136 - No JS(on) of mine
News and ArticlesDouglas Crockford is our featured video, so let's talk about evolving JavaScript and all things JSON. Judicious JSON explains all the weird things in it, you can learn why it can be incredibly slow, people wonder what even is a JSON ...
Dev Digest 136 - No JS(on) of mine

From learning to earning

Jobs that call for the skills explored in this talk.