File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -65,15 +65,23 @@ export default class ArrowToExpression extends BabelVisitor<Expression> {
6565 }
6666
6767 const firstTarget = body . params [ 0 ] ;
68- if ( firstTarget . type !== "Identifier" ) {
69- throw new Error ( "Expecting an identifier" ) ;
68+
69+ let name = "____x" ;
70+
71+ if ( firstTarget ) {
72+
73+ if ( firstTarget . type !== "Identifier" ) {
74+ throw new Error ( "Expecting an identifier" ) ;
75+ }
76+ name = firstTarget . name ;
7077 }
7178
72- target ??= ParameterExpression . create ( { name : firstTarget . name } ) ;
79+
80+ target ??= ParameterExpression . create ( { name} ) ;
7381
7482 body = body . body ;
7583
76- const visitor = new this ( params , target , firstTarget . name ) ;
84+ const visitor = new this ( params , target , name ) ;
7785 return {
7886 params,
7987 target,
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export default async function(this: TestConfig) {
2121 await context . products
2222 . where ( void 0 , ( p ) => ( x ) => x . productID > 1 )
2323 // .trace(console.log)
24- . update ( void 0 , ( p ) => ( x ) => ( {
24+ . update ( void 0 , ( ) => ( ) => ( {
2525 productDescription : "updated"
2626 } ) ) ;
2727
You can’t perform that action at this time.
0 commit comments