If you don't use a block ({}
) as body of an arrow function, the body must be an expression:
ArrowFunction:
ArrowParameters[no LineTerminator here] => ConciseBody
ConciseBody:
[lookahead ≠ { ] AssignmentExpression
{ FunctionBody }
But throw
is a statement, not an expression.
In theory
() => throw x;
is equivalent to
() => { return throw x; }
which would not be valid either.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…