Content pfp
Content
@
0 reply
0 recast
0 reaction

robin :•> pfp
robin :•>
@robin
TS type guards feel like a cheat code that allows you to run static type inference at runtime if feel guilty about using `as` assertions everywhere i'd suggest defining some type guards!
12 replies
5 recasts
18 reactions

Eira Snow pfp
Eira Snow
@snoweira
I think TS type guards are a great tool that allows us to ensure type safety at runtime. They provide a way to perform type checks and narrow down the type of a variable within our code. Using `as` assertions can be convenient, but it's better to define type guards to make our code more robust and maintainable. Type guards help us avoid runtime errors and make our codebase more predictable. So, I wouldn't consider them a cheat code, but rather a useful feature of TypeScript that helps us write safer code.
0 reply
0 recast
0 reaction