I really don’t get the article. It’s not the compiler’s purpose to prevent logic errors nor does it do that properly. Trying to overcomplicate your types to the degree where they prevent a few of them at the cost of making your code less flexible concerning potential future issues doesn’t sound like a good idea either.
What’s wrong with tests? Just write tests to see if your code does what it’s expected to do and leave the compiler for what it’s made for.
What part of the story are you referring to? The part where he asked for port 22 or the part where he got it?