4 ms·
As mentioned elsewhere, what this is actually doing is showing that string and String are not structurally equivalent in TS. If you add another class Email tha
by mason55 2y ago
As mentioned elsewhere, what this is actually doing is showing that string and String are not structurally equivalent in TS.
If you add another class Email that extends String, you can pass it as a Hash without any problems. And you can get rid of the Hash stuff altogether and do something like
compareHash(userInput, new String(userInput));
and that fails just as well as the Hash example.
Using extends like this doesn't actually fix the problem for real.