Skip to content

Commit d782731

Browse files
committed
Document E063 and E160
1 parent 35a75b3 commit d782731

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

docs/errors/E063.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# E063: missing operator between expression and arrow function
2+
3+
The left-hand side of `=>` must be a list of parameters. It is a syntax error if
4+
the left-hand side looks like a function call:
5+
6+
let fs = require("fs");
7+
let path = process.argv[2];
8+
fs.readFile(path (err, data) => {
9+
console.log(data);
10+
});
11+
12+
To fix this error, make the left-hand side of `=>` valid by adding an operator
13+
(usually `,`) before the parameter list:
14+
15+
let fs = require("fs");
16+
let path = process.argv[2];
17+
fs.readFile(path, (err, data) => {
18+
console.log(data);
19+
});

docs/errors/E160.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# E160: unexpected '=>'; expected parameter for arrow function, but got an expression instead
2+
3+
The left-hand side of `=>` must be a list of parameters. It is a syntax error if
4+
the left-hand side is instead an expression (such as a property access or a
5+
function call):
6+
7+
if (this.mapSize => this.capacity) {
8+
throw new Error("too many items");
9+
}
10+
11+
let fs = require("fs");
12+
let path = process.argv[2];
13+
fs.mkdir(path () => console.log("done"));
14+
15+
To fix this error, replace `=>` with the intended operator, such as `>=`:
16+
17+
if (this.mapSize >= this.capacity) {
18+
throw new Error("too many items");
19+
}
20+
21+
Alternatively, make the left-hand side of `=>` valid by adding an operator
22+
(usually `,`) before the parameter list:
23+
24+
let fs = require("fs");
25+
let path = process.argv[2];
26+
fs.mkdir(path, () => console.log("done"));

0 commit comments

Comments
 (0)