假设我有 2 个分支 - master 和 feature。此外,我有一个拉取请求,其中包含 2 次从功能到主控的提交。如果我合并它,我将有一个合并提交。这个提交在合并之前已经以某种方式配置了吗?我可以看看它吗?我知道我可以获得 refs/pull-requests/1/from 和 refs/pull-requests/1/merge 分支的哈希值,但是我可以得到类似“合并”提交的信息吗?
我以这种方式检查数组是否包含该值:
testArray.includes(value)
Run Code Online (Sandbox Code Playgroud)
如果数组为空或它包含该值,我需要执行相同的操作。所以我有这样的条件:
if (testArray == [] || testArray.includes(value)) {
// do something
}
Run Code Online (Sandbox Code Playgroud)
但typescript正在尝试执行此条件的第二部分,即使testArray == []。所以我收到一个错误testArray.includes is underfined。
我知道我可以这样修复它:
if (testArray == []) {
// do something
} else if (testArray.includes(value)) {
// do the same thing
}
Run Code Online (Sandbox Code Playgroud)
但看起来不太好。有没有办法把它放在一个if中?
testArray是一个 openapi 查询参数,如果它很重要的话。
我想使用函数的输出值作为该函数正在使用的装饰器的输入。例如,类似的事情:
function dec(otherFuncOutput: string) {
console.log(otherFuncOutput)
}
@dec
function otherFunc(): string {
const otherFuncOutput: string = "output";
return otherFuncOutput;
}
Run Code Online (Sandbox Code Playgroud)
这样做的正确方法是什么?