TypeScript predicates
At first glance, a function like isString seems harmless. It tells TypeScript: "If this function returns true, you can trust that the input is a string." But what TypeScript doesnβt do is verify the logic inside that function. You, the developer, are now responsible for proving that assertion is correct. TypeScript simply takes your word for it
https://fox.layer3.press/articles/0cddbe7b-cce1-4271-82ab-f6f4973b165d