Skip to content

Differences from JavaScript

JS+ is a TypeScript superset. By default all JavaScript and TypeScript syntax is valid in JS+, expect for the following exceptions:

These errors/warnings won’t block you from compiling JS+ into TypeScript/JavaScript

  • undefined should not be used explicitly. For nullish initializations use null instead
  • -0, 0/0 don’t make sense
  • Don’t implicitly coerce strings with +. Use parseInt() or parseFloat() instead
  • isNaN() is a deprecated artifact. Use Number.isNaN() instead
  • Date is a deprecated artifact. Use Temporal instead
  • Errors/warnings related to better syntax implementations (Features)
  • Don’t use JavaScript # private modifier. Prefer TypeScript private keyword instead
  • @ts-check and @ts-nocheck are not allowed. JS+ is typechecked by default and typechecking cannot be turned off
  • @ts-ignore is a deprecated artifact. Use @ts-expect-error instead

This table showcases difference between TypeScript and JS+ errors with JavaScript syntax from the Wtfjs list

Wtf? (Idk man)🥴 JavaScript🧠 TypeScript💚 JS+
[] == ![];true✅ Error✅ Error
true == [];
true == ![];
false == [];
false == ![];
false
false
true
true
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
!!"false" == !!"true";
!!"false" === !!"true"
true
true
✅ Error
✅ Error
✅ Error
✅ Error
"b" + "a" + +"a" + "a";'baNaNa' 🍌👍✅ Error for + coercion
NaN === NaN;
-0 === 0;
NaN === 0/0;
false
false
false
✅ Error
👍
✅ Error
✅ Error
✅ Error for -0
✅ Error
Object.is(NaN, NaN);
Object.is(-0, 0);
Object.is(NaN, 0/0);
true
false
true
👍
👍
👍
👍
✅ Error for -0
✅ Error for 0/0
It’s a failfail👍👍 (for real?)
!![];true✅ Error✅ Error
!!null;
0 == false;
"" == false;
false
true
true
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
document.all instanceof Object;
typeof document.all;
document.all === undefined;
document.all === null;
document.all == true;
true
undefined
false
false
true
👍
👍
👍
👍
✅ Error
✅ Error for document.all
✅ Error for document.all
✅ Error for document.all
✅ Error for document.all
✅ Bro stop with this syntax
Number.MIN_VALUE > 0;true👍👍
typeof null;'object'👍'null' Read more
[1, 2, 3] + [4, 5, 6];'1,2,34,5,6'✅ Error✅ Error
const a = [,,,];
a.length;
a.toString();

3
',,'

👍
👍

👍
👍
[] == '';
[] == 0;
[''] == '';
[0] == 0;
[0] == '';
[''] == 0;

[null] == '';
[null] == 0;
[undefined] == '';
[undefined] == 0;

[[]] == 0;
[[]] == '';
[[[[[[]]]]]] == '';
[[[[[[]]]]]] == 0;
[[[[[[null]]]]]] == 0;
[[[[[[null]]]]]] == '';
[[[[[[undefined]]]]]] == 0;
[[[[[[undefined]]]]]] == '';
true
true
true
true
false
true

true
true
true
true

true
true
true
true
true
true
true
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error

✅ Error
✅ Error
✅ Error
✅ Error

✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error

✅ Error
✅ Error
✅ Error
✅ Error

✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
✅ Error
Number();
Number(undefined);
0
NaN

👍

✅ Error for undefined
parseInt('f*ck');
parseInt('f*ck', 16);

parseInt("Infinity", 10);
parseInt("Infinity", 18);
parseInt("Infinity", 19);
parseInt("Infinity", 23);
parseInt("Infinity", 24);
parseInt("Infinity", 29);
parseInt("Infinity", 30);
parseInt("Infinity", 34);
parseInt("Infinity", 35);
parseInt("Infinity", 36);
parseInt("Infinity", 37);


parseInt(null, 24);
NaN
15

NaN
NaN
18



















23
👍

























✅ Error
👍
























✅ Error
true + true;
(true + true) * (true + true) - true; // -> 3
2
3
✅ Error✅ Error
typeof NaN
typeof Infinity
'number'
'number'
👍
👍
👍
👍
0.1 + 0.20.30000000000000004👍👍
1 < 2 < 3
3 > 2 > 1
true
false
✅ Error👍 duh it works
Funny math
Addition of RegExps
Strings aren’t instances of String
Calling functions with backticks
Callception