TLDR Web Dev · OPINIONS & ADVICE
WHY UNKNOWN TYPES ARE USEFUL
Summary from the TLDR Web Dev newsletter
When data originates from outside your program, its type cannot be guaranteed, so assuming its type can lead to runtime errors. By assigning "unknown" to unverified data, you force yourself to explicitly validate its characteristics before using it, preventing potential errors and improving code safety. While "any" can be tempting to use, it disables type checking, which defeats the purpose of using a type system.