Transformer doesn't work with arrow and anonymous functions
Closed this issue · 0 comments
nandanmen commented
The worker throws errors when the user uses arrow functions in their algorithm. Specifically there are two cases to consider here:
- Default exporting an arrow function
- When a user default exports an arrow function instead of a regular function declaration, the worker throws an error with the message
Expected type "FunctionDeclaration" with option {}, but instead got "ArrowFunctionExpression"
- When a user default exports an arrow function instead of a regular function declaration, the worker throws an error with the message
- Default exporting an anonymous function
- When a user default exports an anonymous function, e.g.
function (a, b)
, then the worker throws a rather unclear error:unknown: Property name expected type of string but got null
- When a user default exports an anonymous function, e.g.
- Assigning arrow functions
- When assigning arrow functions with a debugger statement in that function, the worker fails with a
DataCloneError
because the snapshot records the function itself as part of the available scope
- When assigning arrow functions with a debugger statement in that function, the worker fails with a