Ben Chuanlong Du's Blog

It is never too late to learn.

Hands on JavaScript

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

In [2]:
let a = new Set(3) {1, 2, 3}
1:17 - No overload matches this call.
1:17 - Overload 1 of 2, '(iterable?: Iterable<any>): Set<any>', gave the following error.
1:17 - Argument of type 'number' is not assignable to parameter of type 'Iterable<any>'.
1:17 - Overload 2 of 2, '(values?: readonly any[]): Set<any>', gave the following error.
1:17 - Argument of type 'number' is not assignable to parameter of type 'readonly any[]'.
1:20 - ',' expected.
1:22 - Cannot redeclare block-scoped variable '(Missing)'.
1:22 - ':' expected.
1:25 - Cannot redeclare block-scoped variable '(Missing)'.
1:25 - ':' expected.
1:28 - Cannot redeclare block-scoped variable '(Missing)'.
1:28 - ':' expected.
In [3]:
Set(3)
1:1 - Value of type 'SetConstructor' is not callable. Did you mean to include 'new'?
In [5]:
new Set()
Set(0) {}
In [6]:
{1, 2, 3}
1:2 - Left side of comma operator is unused and has no side effects.
1:2 - Left side of comma operator is unused and has no side effects.
In [7]:
new Set ([1, 2, 3])
Set(3) { 1, 2, 3 }
In [8]:
let x;
In [9]:
typeof(x)
undefined
In [10]:
x == null
true

Comments