-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Describe the bug
Due to incorrect minify, return and async are appended to the output. (returnasync)
For the issue to be reproduced, all of the following complex conditions must be met:
- It must be a currying function
- returning function must be async
- returning function must have two or more arguments.
- Use optional chaining inside the returning function
Input code
const createRegisterItems = registerType => async (a, b) => {
const a = root?.test;
};Output code
"use strict";const createRegisterItems=registerType=>{returnasync(a,b,c)=>{console.log(1);const a=root===null||root===void 0?void 0:root.test}}Config
{
"module": {
"type": "commonjs"
},
"jsc": {
"parser": {
"syntax": "ecmascript"
},
"target": "es2018"
},
"minify": true
}Expected behavior
There must have a space between return and async.
Version
The version of @swc/core: 1.2.74