-
-
Save robertpenner/c2bd733fd936be07de636161a1c2e031 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[] + []; // JavaScript will give you "" (which makes little sense), TypeScript will error | |
// | |
// other things that are nonsensical in JavaScript | |
// - don't give a runtime error (making debugging hard) | |
// - but TypeScript will give a compile time error (making debugging unnecessary) | |
// | |
{} + []; // JS : 0, TS Error | |
[] + {}; // JS : "[object Object]", TS Error | |
{} + {}; // JS : NaN, TS Error | |
"hello" - 1; // JS : NaN, TS Error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment