Created
August 22, 2016 22:44
Star
You must be signed in to star a gist
This file contains 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