js里()().then()是什么写法

              (async ()=>{
                const arr = []
                for (let item of res.tempFilePaths) {
                  // 依次上传
                  const src = await upload(item)
                  arr.push(src)
                }
                return arr
              })().then(res => {
                wx.hideLoading()
                resolve(res)
              })

这段代码是不是promise的简写?第一次见()().then();
有没有相关写法资料

分开说,()()是直接调用函数的意思的意思,可以不用声明函数名称直接调用,
你这里调用的就是()=>{...}
然后由于这个箭头函数

( async ()=>{...} )()

然后就是.then了,涉及到promise,只有前面的返回结果是promise时才可以进行.then下一步回调
但是为什么这里没有出现promise还可以使用.then呢
因为异步async函数返回值会被自动转化为promise
也就是arr会变成promise返回

你得明白async的返回值类型是啥,就是一个泛型的Promise