Using "!" in TypeScript is often a hack that reduces type safety


Using "!" in TypeScript is often a hack that reduces type safety.

Instead, it's typically best to:
1. Check if the expected data exists.
2. Throw an error if it doesn't.

Benefits:
✅ TypeScript assures we're covering edge cases.
✅ We get type safety throughout the code.

View original on X